36 #pragma GCC diagnostic ignored "-Wunused-variable" 37 #pragma GCC diagnostic ignored "-Wunused-parameter" 39 #include <Epetra_ConfigDefs.h> 42 #include <Epetra_MpiComm.h> 44 #include <Epetra_SerialComm.h> 47 #include <lifev/core/LifeV.hpp> 48 #include <lifev/core/filter/GetPot.hpp> 49 #include <lifev/core/mesh/MeshPartitioner.hpp> 50 #include <lifev/core/mesh/MeshData.hpp> 51 #include <lifev/core/filter/ExporterHDF5.hpp> 52 #include <lifev/core/interpolation/Interpolation.hpp> 53 #include <Teuchos_ParameterList.hpp> 54 #include <Teuchos_XMLParameterListHelpers.hpp> 55 #include <Teuchos_RCP.hpp> 58 #pragma GCC diagnostic warning "-Wunused-variable" 59 #pragma GCC diagnostic warning "-Wunused-parameter" 61 using namespace LifeV;
63 double fx (
double x,
double y,
double z)
65 return sin (x) + y + z;
68 double fy (
double x,
double y,
double z)
70 return sin (y) + x + z;
73 double fz (
double x,
double y,
double z)
75 return sin (z) + x + y ;
83 return sin (x) + y + z;
86 return sin (y) + x + z;
89 return sin (z) + x + y ;
92 ERROR_MSG (
"This entry is not allowed: ud_functions.hpp");
112 ERROR_MSG (
"This entry is not allowed: ud_functions.hpp");
118 int main (
int argc,
char** argv )
123 typedef VectorEpetra vector_Type;
124 typedef std::shared_ptr<vector_Type > vectorPtr_Type;
125 typedef RegionMesh<LinearTetra > mesh_Type;
126 typedef std::shared_ptr< mesh_Type > meshPtr_Type;
127 typedef FESpace< RegionMesh<LinearTetra>, MapEpetra > FESpace_Type;
129 std::shared_ptr<Epetra_Comm> Comm;
131 MPI_Init (&argc, &argv);
132 Comm.reset (
new Epetra_MpiComm (MPI_COMM_WORLD) );
134 Comm.reset (
new Epetra_SerialComm() );
142 Teuchos::RCP< Teuchos::ParameterList > belosList = Teuchos::rcp (
new Teuchos::ParameterList );
143 belosList = Teuchos::getParametersFromXmlFile (
"SolverParamList_rbf3d.xml" );
146 MeshData Solid_mesh_data;
147 meshPtr_Type Solid_mesh_ptr (
new mesh_Type ( Comm ) );
148 Solid_mesh_data.setup (dataFile,
"solid/space_discretization");
149 readMesh (*Solid_mesh_ptr, Solid_mesh_data);
151 MeshData Fluid_mesh_data;
152 meshPtr_Type Fluid_mesh_ptr (
new mesh_Type ( Comm ) );
153 Fluid_mesh_data.setup (dataFile,
"fluid/space_discretization");
154 readMesh (*Fluid_mesh_ptr, Fluid_mesh_data);
157 MeshPartitioner<mesh_Type> Solid_mesh_part;
158 std::shared_ptr<mesh_Type> Solid_localMesh;
159 Solid_mesh_part.doPartition (Solid_mesh_ptr, Comm);
160 Solid_localMesh = Solid_mesh_part.meshPartition();
162 MeshPartitioner<mesh_Type> Fluid_mesh_part;
163 std::shared_ptr<mesh_Type> Fluid_localMesh;
164 Fluid_mesh_part.doPartition (Fluid_mesh_ptr, Comm);
165 Fluid_localMesh = Fluid_mesh_part.meshPartition();
168 std::string orderFluid = dataFile(
"fluid/space_discretization/order",
"default");
169 std::string orderStructure = dataFile(
"solid/space_discretization/order",
"default");
171 std::shared_ptr<FESpace<mesh_Type, MapEpetra> > Solid_fieldFESpace_whole (
new FESpace<mesh_Type, MapEpetra> (Solid_mesh_ptr, orderStructure, 3, Comm) );
172 std::shared_ptr<FESpace<mesh_Type, MapEpetra> > Fluid_fieldFESpace_whole (
new FESpace<mesh_Type, MapEpetra> (Fluid_mesh_ptr, orderFluid, 3, Comm) );
174 std::shared_ptr<FESpace<mesh_Type, MapEpetra> > Solid_fieldFESpace (
new FESpace<mesh_Type, MapEpetra> (Solid_localMesh, orderStructure, 3, Comm) );
175 std::shared_ptr<FESpace<mesh_Type, MapEpetra> > Fluid_fieldFESpace (
new FESpace<mesh_Type, MapEpetra> (Fluid_localMesh, orderFluid, 3, Comm) );
177 Interpolation intergrid;
178 intergrid.setup(dataFile, belosList);
179 intergrid.setFlag( dataFile(
"flag/interface", 1 ) );
180 intergrid.setMeshSize(MeshUtility::MeshStatistics::computeSize(*Fluid_mesh_ptr).maxH);
183 vectorPtr_Type Solid_vector (
new vector_Type (Solid_fieldFESpace->map(), Unique) );
184 vectorPtr_Type Fluid_solution (
new vector_Type (Fluid_fieldFESpace->map(), Unique) );
185 intergrid.setVectors(Solid_vector, Fluid_solution);
188 intergrid.buildTableDofs_known ( Solid_fieldFESpace_whole );
189 intergrid.buildTableDofs_unknown ( Fluid_fieldFESpace_whole );
192 intergrid.identifyNodes_known ( );
193 intergrid.identifyNodes_unknown ( );
196 intergrid.buildKnownInterfaceMap();
197 intergrid.buildUnknownInterfaceMap();
199 intergrid.buildOperators();
201 vectorPtr_Type Solid_vector_one (
new vector_Type (Solid_fieldFESpace->map(), Unique) );
202 Solid_fieldFESpace->interpolate (
static_cast<FESpace_Type::function_Type> ( exact_sol_easy ), *Solid_vector_one, 0.0 );
205 Solid_fieldFESpace->interpolate (
static_cast<FESpace_Type::function_Type> ( exact_sol ), *Solid_vector, 0.0 );
208 vectorPtr_Type solidVectorOnGamma;
209 vectorPtr_Type solidVectorOnOmega;
211 intergrid.restrictOmegaToGamma_Known(Solid_vector, solidVectorOnGamma);
212 intergrid.expandGammaToOmega_Known(solidVectorOnGamma, solidVectorOnOmega);
215 ExporterHDF5<mesh_Type> Solid_exporter (dataFile, Solid_localMesh,
"InputField", Comm->MyPID() );
216 Solid_exporter.setMeshProcId (Solid_localMesh, Comm->MyPID() );
217 Solid_exporter.exportPID (Solid_localMesh, Comm,
true );
218 Solid_exporter.addVariable (ExporterData<mesh_Type>::VectorField,
"f(x,y,z)", Solid_fieldFESpace, Solid_vector, UInt (0) );
219 Solid_exporter.addVariable (ExporterData<mesh_Type>::VectorField,
"restrict-expand", Solid_fieldFESpace, solidVectorOnOmega, UInt (0) );
220 Solid_exporter.postProcess (0);
221 Solid_exporter.closeFile();
224 ExporterHDF5<mesh_Type> Fluid_exporter (dataFile, Fluid_localMesh,
"Results", Comm->MyPID() );
225 Fluid_exporter.setMeshProcId (Fluid_localMesh, Comm->MyPID() );
226 Fluid_exporter.exportPID (Fluid_localMesh, Comm,
true );
227 Fluid_exporter.addVariable (ExporterData<mesh_Type>::VectorField,
"Solution", Fluid_fieldFESpace, Fluid_solution, UInt (0) );
230 intergrid.updateRhs (Solid_vector);
233 intergrid.interpolate();
236 intergrid.solution (Fluid_solution);
239 Fluid_exporter.postProcess (0);
242 intergrid.updateRhs (Solid_vector_one);
245 intergrid.interpolate();
248 intergrid.solution (Fluid_solution);
251 Fluid_exporter.postProcess (1);
254 vectorPtr_Type Fluid_solutionOnGamma;
255 intergrid.getSolutionOnGamma (Fluid_solutionOnGamma);
257 Fluid_exporter.closeFile();
259 Real check = Fluid_solution->norm2();
265 if ( (check - 1542.4) < 0.1 )
267 return ( EXIT_SUCCESS );
271 return ( EXIT_FAILURE );
Real exact_sol_easy(const Real &, const Real &, const Real &, const Real &, const ID &i)
GetPot(const int argc_, char **argv_, const char *FieldSeparator=0x0)
double fy(double x, double y, double z)
Real exact_sol(const Real &, const Real &x, const Real &y, const Real &z, const ID &i)
double fz(double x, double y, double z)
double Real
Generic real data.
GetPot(const STRING_VECTOR &FileNameList)
const std::string follow(const char *Default, unsigned No, const char *Option,...)
double fx(double x, double y, double z)
int main(int argc, char **argv)