Test for fsiCoupling::TrasferDisplacementsToFluid function.
This function uses simple static problem data to test the transferagent->interpolate function. Displacement vector for solid agent is set to be the value of linear function along the z direction. After interpolation, displacement vector for fluid agent should have received these values (approximately).
820 double time_final = 0.05;
821 double timestep = 2.0e-3;
828 std::string fluidDir;
829 std::string simStaticDir;
830 fluidDir = IRAD::Sys::CWD() +
"/SimpleStatic/fluid";
831 simStaticDir = IRAD::Sys::CWD() +
"/SimpleStatic";
832 if(!(IRAD::Sys::FILEEXISTS(fluidDir)||(IRAD::Sys::FILEEXISTS(simStaticDir)))){
833 std::cout <<
"SimpleStatic / fluid Folders do not exists!" << std::endl;
835 result.UpdateResult(
"fsiCoupler:Works",works);
839 IntDir = IRAD::Sys::ChDir(simStaticDir);
841 std::cout <<
"GetInputData Error: Could not change directory to "
842 << fluidDir <<
". Exiting (fail). " << std::endl;
844 result.UpdateResult(
"fsiCoupler:Works",works);
846 std::system(
"chmod 755 Allclean Allrun AllrunPar makeLinks makeSerialLinks removeSerialLinks");
847 std::system(
"./Allclean");
848 std::system(
"./Allrun");
849 IntDir = IRAD::Sys::ChDir(fluidDir);
851 std::cout <<
"GetInputData Error: Could not change directory to "
852 << fluidDir <<
". Exiting (fail). " << std::endl;
854 result.UpdateResult(
"fsiCoupler:Works",works);
860 std::string fluidSolverName(
"OpenFoamFSI");
861 std::string solidSolverName(
"ElmerCSC");
862 std::string transferServiceName(
"SurfX");
863 std::string runMode(
"1");
866 std::cout <<
"COM loading all this junks" << std::endl;
867 COM_load_module(fluidSolverName.c_str(),
"FluidsComponentInterface");
868 COM_load_module(solidSolverName.c_str(),
"StructuresComponentInterface");
869 COM_load_module(
"SurfUtil",
"SurfUtil");
870 COM_load_module(
"Simpal",
"Simpal");
874 componentInterfaceNames.push_back(
"FluidsComponentInterface");
875 componentInterfaceNames.push_back(
"StructuresComponentInterface");
876 componentInterfaceNames.push_back(
"TransferInterface");
877 componentInterfaceNames.push_back(
"SurfUtil");
878 componentInterfaceNames.push_back(
"Simpal");
887 int maxSubSteps = 1000;
888 int dumpinterval = 1;
891 double *fluidDisp1 = NULL;
892 double *fluidDisp2 = NULL;
893 double *solidDisp1 = NULL;
894 double *solidDisp2 = NULL;
918 double totalFluidDis, totalSolidDis = 0;
921 totalFluidDis += fluidDisp2[3*i+1];
922 totalSolidDis += solidDisp2[3*i+1];
925 std::cout <<
"total fluid dis = " << totalFluidDis << std::endl;
926 std::cout <<
"total solid dis = " << totalSolidDis << std::endl;
929 double totalError = (totalFluidDis - totalSolidDis) / totalSolidDis;
931 std::cout <<
"total error = " << totalError << std::endl;
932 if(totalError >= .05) works =
false;
934 result.UpdateResult(
"TransferDisplacementsToFluid:Works",works);
std::string getSolidIntName()
solidagent * getStructureAgent()
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()
std::vector< std::string > componentInterfaceNames
const std::vector< double > & Coordinates() const
void SetVerbLevel(int verb)
std::string getFluidIntName()
virtual int Initialize(std::vector< std::string > &componentInterfaceNames, double finalTime, double timeStep)