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__FluidAgentRun ( ResultsType &  result)
inlinevirtual

Test for fluidAgent->Run() function.

Definition at line 938 of file ElmerFoamFSITest.H.

References TestingObject< ResultsType >::__helper(), TestingObject< ResultsType >::componentInterfaceNames, 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(), fsicoupling::SetRunMode(), fsicoupling::SetVerbLevel(), TestingObject< ResultsType >::tractionCheck(), fsicoupling::TransferDisplacementsToFluid(), and TestingObject< ResultsType >::verblevel.

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

938  {
939 
940  double time_final = 0.05;
941  double timestep = 2.0e-3;
942  int verblevel = 3;
943  bool works = true;
944  int IntDir;
945 
946  // Copying the SimpleStatic data using getinputdata() helper function.
947  bool work =__helper();
948  std::string fluidDir;
949  std::string simStaticDir;
950  fluidDir = IRAD::Sys::CWD() + "/SimpleStatic/fluid";
951  simStaticDir = IRAD::Sys::CWD() + "/SimpleStatic";
952  if(!(IRAD::Sys::FILEEXISTS(fluidDir)||(IRAD::Sys::FILEEXISTS(simStaticDir)))){
953  std::cout << "SimpleStatic / fluid Folders do not exists!" << std::endl;
954  works = false;
955  result.UpdateResult("fsiCoupler:Works",works);
956  return;
957  }
958  else{
959  IntDir = IRAD::Sys::ChDir(simStaticDir);
960  if(IntDir == -1){
961  std::cout << "GetInputData Error: Could not change directory to "
962  << fluidDir << ". Exiting (fail). " << std::endl;
963  works = false;
964  result.UpdateResult("fsiCoupler:Works",works);
965  }
966  std::system("chmod 755 Allclean Allrun AllrunPar makeLinks makeSerialLinks removeSerialLinks");
967  std::system("./Allclean");
968  std::system("./Allrun");
969  IntDir = IRAD::Sys::ChDir(fluidDir);
970  if(IntDir == -1){
971  std::cout << "GetInputData Error: Could not change directory to "
972  << fluidDir << ". Exiting (fail). " << std::endl;
973  works = false;
974  result.UpdateResult("fsiCoupler:Works",works);
975  }
976  }
977 
979  std::string fluidSolverName("OpenFoamFSI");
980  std::string solidSolverName("ElmerCSC");
981  std::string transferServiceName("SurfX");
982  std::string runMode("1");
983 
984  std::cout << "COM loading all this junks" << std::endl;
985  COM_load_module(fluidSolverName.c_str(),"FluidsComponentInterface");
986  COM_load_module(solidSolverName.c_str(),"StructuresComponentInterface");
987  COM_load_module("SurfUtil","SurfUtil");
988  COM_load_module("Simpal","Simpal");
989 
990  std::vector<std::string> componentInterfaceNames;
991  componentInterfaceNames.push_back("FluidsComponentInterface");
992  componentInterfaceNames.push_back("StructuresComponentInterface");
993  componentInterfaceNames.push_back("TransferInterface");
994  componentInterfaceNames.push_back("SurfUtil");
995  componentInterfaceNames.push_back("Simpal");
996 
997  fsiCoupler.SetRunMode(runMode);
998  fsiCoupler.SetVerbLevel(verblevel);
999  fsiCoupler.Initialize(componentInterfaceNames, time_final, timestep);
1000 
1001  // Mimicing FsiCoupler::run, intializing variables, etc.
1002  int innerCount = 0;
1003  int maxSubSteps = 1000;
1004  int dumpinterval = 1;
1005  int systemStep = 0;
1006 
1007  double *fluidDisp1 = NULL;
1008  double *fluidDisp2 = NULL;
1009  double *solidDisp1 = NULL;
1010  double *solidDisp2 = NULL;
1011 
1012  // Get the displacement vector values for both solid and fluid domain.
1013  std::string fluidsCoordinateName(fsiCoupler.getFluidIntName()+".solidDisplacement");
1014  std::string solidsCoordinateName(fsiCoupler.getSolidIntName()+".Displacements");
1015  COM_get_array(fluidsCoordinateName.c_str(),(fsiCoupler.getFluidAgent())->PaneID(),&fluidDisp1);
1016  COM_get_array(solidsCoordinateName.c_str(),(fsiCoupler.getStructureAgent())->PaneID(),&solidDisp1);
1017 
1018  if(!(fsiCoupler.getRunMode())){
1020  }
1021  double simultime = fsiCoupler.getSimulationTime();
1022 
1023 
1024  std::cout << "simultime is =" << simultime << std::endl;
1025  if(fsiCoupler.getRunMode() < 2){
1028  }
1029 
1030  int stride = 0;
1031  int cap = 0;
1032  double *tractions = NULL;
1033  COM_get_array((fsiCoupler.getFluidIntName()+".traction").c_str(),101,&tractions,&stride,&cap);
1034  int isize = cap*stride;
1035 
1036  /*for(int i = 0; i < isize/3 ; i++){
1037  std::cout << "tractions[" << i << "] = " << tractions[3*i] << ", " << tractions[3*i+1] << ", " << tractions[3*i+2] << std::endl;
1038  } */
1039 
1040  works = tractionCheck(tractions,isize);
1041 
1042  result.UpdateResult("FluidAgentRun:Works",works);
1043  }
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
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
bool tractionCheck(double *tractions, int isize)
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: