ElmerFoamFSI  2.0
ElmerFoamFSI is fluid-solid interaction simulation application built up from OpenFOAM CFD and Elmer CSM coupled through the IMPACT multiphysics software integration infrastructure.
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Macros Groups Pages
virtual void Test__SolidAgentRun ( ResultsType &  result)
inlinevirtual

Test for solidAgent->Run() function.

Definition at line 1404 of file ElmerFoamFSITest.H.

References TestingObject< ResultsType >::__helper(), TestingObject< ResultsType >::componentInterfaceNames, TestingObject< ResultsType >::DisplacementCheck(), TestingObject< ResultsType >::fsiCoupler, fsicoupling::getFluidAgent(), fsicoupling::getFluidIntName(), fsicoupling::getRunMode(), fsicoupling::getSimulationFinalTime(), fsicoupling::getSimulationTime(), fsicoupling::getSolidIntName(), fsicoupling::getStructureAgent(), TestingObject< ResultsType >::global, fsicoupling::Initialize(), agentbase::InitializeTimeStep(), openfoamagent::Run(), elmeragent::Run(), fsicoupling::SetRunMode(), fsicoupling::SetVerbLevel(), fsicoupling::TransferDisplacementsToFluid(), fsicoupling::TransferLoadsToStructures(), and TestingObject< ResultsType >::verblevel.

Referenced by TestingObject< ResultsType >::Process(), and TestingObject< ResultsType >::RunTest().

1404  {
1405 
1406 
1407  double time_final = 0.05;
1408  double timestep = 2.0e-3;
1409  int verblevel = 3;
1410  bool works = true;
1411  int IntDir;
1412 
1413  // Copying the SimpleStatic data using getinputdata() helper function.
1414  bool work =__helper();
1415  std::string fluidDir;
1416  std::string simStaticDir;
1417  fluidDir = IRAD::Sys::CWD() + "/SimpleStatic/fluid";
1418  simStaticDir = IRAD::Sys::CWD() + "/SimpleStatic";
1419  if(!(IRAD::Sys::FILEEXISTS(fluidDir)||(IRAD::Sys::FILEEXISTS(simStaticDir)))){
1420  std::cout << "SimpleStatic / fluid Folders do not exists!" << std::endl;
1421  works = false;
1422  result.UpdateResult("fsiCoupler:Works",works);
1423  return;
1424  }
1425  else{
1426  IntDir = IRAD::Sys::ChDir(simStaticDir);
1427  if(IntDir == -1){
1428  std::cout << "GetInputData Error: Could not change directory to "
1429  << fluidDir << ". Exiting (fail). " << std::endl;
1430  works = false;
1431  result.UpdateResult("fsiCoupler:Works",works);
1432  }
1433  std::system("chmod 755 Allclean Allrun AllrunPar makeLinks makeSerialLinks removeSerialLinks");
1434  std::system("./Allclean");
1435  std::system("./Allrun");
1436  IntDir = IRAD::Sys::ChDir(fluidDir);
1437  if(IntDir == -1){
1438  std::cout << "GetInputData Error: Could not change directory to "
1439  << fluidDir << ". Exiting (fail). " << std::endl;
1440  works = false;
1441  result.UpdateResult("fsiCoupler:Works",works);
1442  }
1443  }
1444 
1446  std::string fluidSolverName("OpenFoamFSI");
1447  std::string solidSolverName("ElmerCSC");
1448  std::string transferServiceName("SurfX");
1449  std::string runMode("1");
1450 
1451  COM_load_module(fluidSolverName.c_str(),"FluidsComponentInterface");
1452  COM_load_module(solidSolverName.c_str(),"StructuresComponentInterface");
1453  COM_load_module("SurfUtil","SurfUtil");
1454  COM_load_module("Simpal","Simpal");
1455 
1456  std::vector<std::string> componentInterfaceNames;
1457  componentInterfaceNames.push_back("FluidsComponentInterface");
1458  componentInterfaceNames.push_back("StructuresComponentInterface");
1459  componentInterfaceNames.push_back("TransferInterface");
1460  componentInterfaceNames.push_back("SurfUtil");
1461  componentInterfaceNames.push_back("Simpal");
1462 
1463  fsiCoupler.SetRunMode(runMode);
1464  fsiCoupler.SetVerbLevel(verblevel);
1465  fsiCoupler.Initialize(componentInterfaceNames, time_final, timestep);
1466 
1467  // Mimicing FsiCoupler::run, intializing variables, etc.
1468  int innerCount = 0;
1469  int maxSubSteps = 1000;
1470  int dumpinterval = 1;
1471  int systemStep = 0;
1472 
1473 
1474  if(!(fsiCoupler.getRunMode())){
1476  }
1477  double simultime = fsiCoupler.getSimulationTime();
1478 
1479 
1480  std::cout << "simultime is =" << simultime << std::endl;
1481  if(fsiCoupler.getRunMode() < 2){
1484  }
1485 
1486  // setting a traction value so that you have bigger numbers for solid displacement later
1487  double * tractions;
1488  int stride = 0;
1489  int cap = 0;
1490  // Get the traction vector values for fluid domain.
1491  COM_get_array((fsiCoupler.getFluidIntName()+".traction").c_str(),101,&tractions,&stride,&cap);
1492  std::cout << "stride and cap = " << stride << "," << cap << std::endl;
1493  //traction becomes Ycoord * 3 + 2
1494  int isize = cap * stride ;
1495  for(int i = 0; i < isize/3 ; i++){
1496  //tractions[3*i+1] = 3*fsiCoupler.getFluidAgent()->Coordinates()[3*i+2]+2;
1497  //tractions[3*i+1] = fsiCoupler.getFluidAgent()->Coordinates()[3*i+2];
1498  //tractions[3*i+1] = 1;
1499  tractions[3*i+1] = 50000;
1500  std::cout << "tractions[" << i << "] = " << tractions[3*i] << ", " << tractions[3*i+1] << ", " << tractions[3*i+2] << std::endl;
1501  }
1502 
1503 
1505 
1506 
1507  // Solid Agent Run executing
1508  if( fsiCoupler.getRunMode() !=1){
1511  }
1512 
1513  double *solidDisp = NULL;
1514 
1515  // Get the displacement vector values for solid.
1516  std::string solidsCoordinateName(fsiCoupler.getSolidIntName()+".Displacements");
1517  COM_get_array(solidsCoordinateName.c_str(),(fsiCoupler.getStructureAgent())->PaneID(),&solidDisp);
1518 
1519 
1520  works = DisplacementCheck(solidDisp, 300);
1521  result.UpdateResult("SolidAgentRun:Works",works);
1522  }
std::string getSolidIntName()
Definition: FsiCoupling.H:712
solidagent * getStructureAgent()
Definition: FsiCoupling.H:709
double getSimulationTime()
Definition: FsiCoupling.H:704
virtual int Run(double endTime)
Definition: OpenFoamAgent.H:65
bool DisplacementCheck(double *disp, int size)
int TransferDisplacementsToFluid(solidagent *solidAgent, fluidagent *fluidAgent)
Definition: FsiCoupling.H:59
int verblevel
track verbosity level for tests
fsicoupling fsiCoupler
Instantiation of class for use with the fsiCoupler &amp; Agent tests.
void SetRunMode(const std::string &inMode)
Definition: FsiCoupling.H:376
fluidagent * getFluidAgent()
Definition: FsiCoupling.H:708
virtual int InitializeTimeStep(double time)
Definition: Orchestrator.H:24
std::vector< std::string > componentInterfaceNames
int TransferLoadsToStructures(fluidagent *fluidAgent, solidagent *solidAgent)
Definition: FsiCoupling.H:176
virtual int Run(double time)
Definition: ElmerAgent.H:71
void SetVerbLevel(int verb)
Definition: FsiCoupling.H:56
int getRunMode()
Definition: FsiCoupling.H:706
double getSimulationFinalTime()
Definition: FsiCoupling.H:705
std::string getFluidIntName()
Definition: FsiCoupling.H:711
virtual int Initialize(std::vector< std::string > &componentInterfaceNames, double finalTime, double timeStep)
Definition: FsiCoupling.H:498

Here is the call graph for this function:

Here is the caller graph for this function: