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> 48 #pragma GCC diagnostic warning "-Wunused-variable" 49 #pragma GCC diagnostic warning "-Wunused-parameter" 52 #include <lifev/core/array/MatrixEpetra.hpp> 53 #include <lifev/core/array/MapEpetra.hpp> 54 #include <lifev/core/mesh/MeshData.hpp> 55 #include <lifev/core/mesh/MeshPartitioner.hpp> 56 #include <lifev/navier_stokes/fem/TimeAdvanceBDFNavierStokes.hpp> 58 #include <lifev/core/fem/BCManage.hpp> 60 #include <lifev/core/filter/ExporterHDF5.hpp> 62 #include <lifev/core/filter/ExporterEnsight.hpp> 64 #include <lifev/eta/expression/Integrate.hpp> 65 #include <lifev/navier_stokes/solver/OseenData.hpp> 66 #include <lifev/navier_stokes/solver/StabilizationIP.hpp> 76 using namespace LifeV;
119 std::string data_file_name = command_line.follow (
"data", 2,
"-f",
"--file");
120 GetPot dataFile ( data_file_name );
122 M_d->data_file_name = data_file_name;
124 M_d->Re = dataFile (
"fluid/physics/Re", 1. );
125 M_d->nu = dataFile (
"fluid/physics/viscosity", 1. );
126 M_d->H = dataFile (
"fluid/physics/H", 20. );
127 M_d->D = dataFile (
"fluid/physics/D", 1. );
129 M_d->density = dataFile (
"fluid/physics/density", 1. );
131 M_d->rhos = dataFile (
"membrane/physics/density_sol", 1. );
132 M_d->E = dataFile (
"membrane/physics/young", 1. );
133 M_d->ni = dataFile (
"membrane/physics/poisson", 1. );
134 M_d->Hs = dataFile (
"membrane/physics/wall_thickness", 1. );
137 M_d->initial_sol = (std::string) dataFile (
"fluid/problem/initial_sol",
"none");
138 M_d->stabilization = (std::string) dataFile (
"fluid/problem/stabilization",
"none");
139 M_d->numLM = dataFile (
"fluid/problem/numLM" , 0 );
140 M_d->useFlowRate = 0;
141 if ( M_d->numLM > 0 )
143 M_d->useFlowRate = 1 ;
145 M_d->transpirationOrder = dataFile (
"fluid/problem/transpiration_order" , 0 );
148 std::cout <<
"mpi initialization ... " << std::endl;
151 M_d->comm.reset (
new Epetra_MpiComm ( MPI_COMM_WORLD ) );
152 if (!M_d->comm->MyPID() )
154 std::cout <<
"My PID = " << M_d->comm->MyPID() <<
" out of " << ntasks <<
" running." << std::endl;
155 std::cout <<
"fluid density = " << M_d->density << std::endl
156 <<
"nu = " << M_d->nu << std::endl
157 <<
"poisson = " << M_d->ni << std::endl
158 <<
"initial solution = " << M_d->initial_sol << std::endl
159 <<
"Young modulus = " << M_d->E << std::endl
160 <<
"Wall thickness = " << M_d->Hs << std::endl;
165 M_d->comm.reset (
new Epetra_SerialComm() );
174 bool verbose = (M_d->comm->MyPID() == 0);
178 GetPot dataFile ( M_d->data_file_name );
181 Real NSSupg (dataFile
("fluid/space_discretization/supg_coeff", 1e-3
) );
182 Real NSPspg (dataFile
("fluid/space_discretization/pspg_coeff", 1e-3
) );
183 Real NSdivdiv (dataFile
("fluid/space_discretization/dividiv_coeff", 5e-2
) );
184 Real OUTLET (dataFile
("fluid/problem/boundary_flags/outlet", 3
) );
185 Real INLET (dataFile
("fluid/problem/boundary_flags/inlet", 2
) );
186 Real WALL (dataFile
("fluid/problem/boundary_flags/wall", 100
) );
187 Real RING (dataFile
("fluid/problem/boundary_flags/ring_in", 20
) );
188 Real RING2 (dataFile
("fluid/problem/boundary_flags/ring_out", 30
) );
190 std::shared_ptr<OseenData> oseenData (
new OseenData() );
191 oseenData->setup ( dataFile );
194 meshData.setup (dataFile,
"fluid/space_discretization");
196 Real LameI = (M_d->E * M_d->ni ) / ( ( 1 - M_d->ni * M_d->ni ) );
197 Real LameII = M_d->E / ( 2 * ( 1 + M_d->ni ) );
201 std::cout <<
" Outlet : " << OUTLET << std::endl;
202 std::cout <<
" Wall : " << WALL << std::endl;
206 std::cout <<
" LameI : " << LameI << std::endl;
207 std::cout <<
" LameII : " << LameII << std::endl;
214 std::shared_ptr< mesh_type > fullMeshPtr (
new mesh_type);
215 readMesh (*fullMeshPtr, meshData);
219 std::string uOrder = dataFile (
"fluid/space_discretization/vel_order",
"P1");
220 std::string pOrder = dataFile (
"fluid/space_discretization/press_order",
"P1");
224 std::cout <<
"Building the FE spaces ... " << std::flush;
227 M_uFESpace.reset (
new FESpace< mesh_type, MapEpetra > ( meshPart, uOrder, 3, M_d->comm ) );
228 M_uCompFESpace.reset (
new FESpace< mesh_type, MapEpetra > ( meshPart, uOrder, 1, M_d->comm ) );
229 M_pFESpace.reset (
new FESpace< mesh_type, MapEpetra > ( meshPart, pOrder, 1, M_d->comm ) );
231 M_ETuFESpace.reset (
new ETFESpace< mesh_type, MapEpetra, 3, 3 > ( meshPart, & (M_uFESpace->refFE() ), M_d->comm ) );
232 M_ETpFESpace.reset (
new ETFESpace< mesh_type, MapEpetra, 3, 1 > ( meshPart, & (M_pFESpace->refFE() ), M_d->comm ) );
236 std::cout <<
"ok." << std::endl;
239 UInt totalVelDof = M_uFESpace->map().map ( Unique )->NumGlobalElements();
240 UInt totalPressDof = M_pFESpace->map().map ( Unique )->NumGlobalElements();
244 std::cout <<
"Total Velocity DOF = " << totalVelDof << std::endl;
248 std::cout <<
"Total Pressure DOF = " << totalPressDof << std::endl;
252 std::cout <<
"Total FLux DOF = " << M_d->numLM << std::endl;
255 MapEpetra fluidMap ( M_uFESpace->map() );
256 MapEpetra fluxMap ( M_d->numLM, M_d->comm );
257 MapEpetra fullMap ( M_uFESpace->map() + M_pFESpace->map() + fluxMap );
260 interfaceDOF.update ( *M_uFESpace->mesh() , WALL , *M_uFESpace->mesh() , WALL , 0);
261 createInterfaceMap ( interfaceDOF.localDofMap() , M_uFESpace->dof() );
267 std::cout <<
"Calling the solver constructors ... ";
270 SolverAztecOO NSSolver;
271 NSSolver.setCommunicator (M_d->comm);
272 NSSolver.setDataFromGetPot (dataFile,
"solver");
273 NSSolver.setupPreconditioner (dataFile,
"prec");
277 std::cout <<
"done." << std::endl;
286 std::cout <<
"Calling the TimeAdvance constructors ... ";
289 Real dt = oseenData->dataTime()->timeStep();
290 Real t0 = oseenData->dataTime()->initialTime();
291 Real tFinal = oseenData->dataTime()->endTime();
294 fluidTimeAdvance.setup (oseenData->dataTimeAdvance()->orderBDF() );
297 dispTimeAdvance.setup (oseenData->dataTimeAdvance()->orderBDF() );
300 fluidTimeAdvance.bdfVelocity().setTimeStep (oseenData->dataTime()->timeStep() );
303 fluidTimeAdvance.showMe();
307 dispTimeAdvance.setTimeStep (oseenData->dataTime()->timeStep() );
310 dispTimeAdvance.showMe();
313 Real alpha = fluidTimeAdvance.bdfVelocity().coefficientFirstDerivative (t0);
317 std::cout <<
" done. \n";
326 std::cout <<
"Calling the BCHandler constructor ... ";
331 BCFunctionBase vel_in (flatNormalVelInlet );
332 BCFunctionBase flux_in (linearInletCylinder);
333 BCFunctionBase uZero ( fZero );
334 BCFunctionBase press_out ( p0 );
336 if (M_d->useFlowRate ==
true )
338 bcHFluid.addBC (
"InFlow" , INLET, Flux, Normal, flux_in );
339 bcHFluid.addBC (
"InFlow_2" , OUTLET, Natural, Full, uZero, 3 );
342 bcHFluid.addBC (
"Ring" , RING, EssentialEdges, Full, uZero, 3 );
343 bcHFluid.addBC (
"Ring3" , RING2, EssentialEdges, Full, uZero, 3 );
345 bcHFluid.setOffset (
"InFlow", totalVelDof + totalPressDof);
351 bcHFluid.addBC (
"InFlow" , INLET, Essential, Full, vel_in, 3 );
352 bcHFluid.addBC (
"InFlow_2" , OUTLET, Natural, Normal, press_out );
355 bcHFluid.addBC (
"Ring" , RING, EssentialEdges, Full, uZero, 3 );
356 bcHFluid.addBC (
"Ring3" , RING2, EssentialEdges, Full, uZero, 3 );
362 std::cout <<
" BC done \n";
367 vector_block_type NSSolution (M_ETuFESpace->map() | M_ETpFESpace->map() | fluxMap, Unique);
368 vector_type velocitySolution (M_ETuFESpace->map(), Repeated);
369 vector_type dispSolution (M_ETuFESpace->map(), Repeated);
377 std::cout <<
"Calling the Exporter constructor ... ";
380 std::string
const exporterFileName = dataFile (
"exporter/filename",
"cylinder");
381 UInt exportEach = dataFile
("exporter/each", 1
);
383 ExporterHDF5< mesh_type > exporter ( dataFile, meshPart.meshPartition(), exporterFileName, M_d->comm->MyPID() );
385 vectorPtr_type velAndPressureExporter (
new vector_type (NSSolution, exporter.mapType() ) );
386 vectorPtr_type dispExporter (
new vector_type (dispSolution, Repeated ) );
388 exporter.addVariable ( ExporterData< mesh_type >::VectorField,
"f-velocity",
389 M_uFESpace, velAndPressureExporter, UInt (0) );
391 exporter.addVariable ( ExporterData< mesh_type >::ScalarField,
"f-pressure",
392 M_pFESpace, velAndPressureExporter, UInt (3 * M_uFESpace->dof().numTotalDof() ) );
394 exporter.addVariable ( ExporterData< mesh_type >::VectorField,
"s-displacement",
395 M_uFESpace, dispExporter, UInt (0) ) ;
398 std::cout <<
" done. \n";
407 if (M_d->initial_sol ==
"restart")
409 ASSERT (oseenData->dataTimeAdvance()->orderBDF() == 1,
"Restart works only for BDF1");
413 std::cout << std::endl;
417 std::cout <<
"Restoring the previous solution ... " << std::endl;
420 std::string filename = dataFile (
"importer/filename",
"cylinder");
422 LifeV::ExporterHDF5<mesh_type> importer ( dataFile, filename );
423 importer.setMeshProcId ( M_uFESpace->mesh(), M_d->comm->MyPID() );
425 vectorPtr_type velAndPressureImporter (
new vector_type (NSSolution, importer.mapType() ) );
426 vectorPtr_type dispImporter (
new vector_type (dispSolution, importer.mapType() ) );
428 importer.addVariable ( ExporterData<mesh_type>::VectorField,
431 velAndPressureImporter,
434 importer.addVariable ( ExporterData<mesh_type>::ScalarField,
437 velAndPressureImporter,
438 3 * M_uFESpace->dof().numTotalDof() );
440 importer.addVariable ( ExporterData<mesh_type>::VectorField,
446 exporter.setTimeIndex ( importer.importFromTime (t0) );
448 Real norm = velAndPressureImporter->norm2();
449 *velAndPressureExporter = *velAndPressureImporter;
450 *dispExporter = *dispImporter;
453 std::cout <<
" f- restart solution norm = " << norm << std::endl;
459 velocitySolution.subset ( *velAndPressureExporter );
460 dispSolution = *dispExporter;
462 fluidTimeAdvance.bdfVelocity().setInitialCondition ( * (velAndPressureExporter) );
463 dispTimeAdvance.setInitialCondition ( dispSolution );
465 fluidTimeAdvance.bdfVelocity().updateRHSContribution ( oseenData->dataTime()->timeStep() );
466 dispTimeAdvance.updateRHSContribution (oseenData->dataTime()->timeStep() );
470 std::cout <<
" done \n";
476 std::shared_ptr<matrix_block_type> NSMatrixConstant (
new matrix_block_type ( M_ETuFESpace->map() | M_ETpFESpace->map() | fluxMap ) );
477 *NSMatrixConstant *= 0.0;
478 std::shared_ptr<matrix_block_type> NSMatrixSteadyStokes (
new matrix_block_type ( M_ETuFESpace->map() | M_ETpFESpace->map() | fluxMap ) );
479 *NSMatrixSteadyStokes *= 0.0;
485 std::cout << std::endl;
489 std::cout <<
" ### Simulation times ### " << std::endl;
493 std::cout <<
" From " << t0 <<
" to " << tFinal << std::endl;
497 std::cout <<
" Time step: " << dt << std::endl;
501 std::cout << std::endl;
504 Real currentTime (t0);
507 *NSMatrixConstant *= 0.0;
511 M_pFESpace->interpolate ( uZero , robinExt, 0);
521 elements (M_ETuFESpace->mesh() ),
529 M_d->nu * dot (grad (phi_i) , grad (phi_j) )
532 >> NSMatrixSteadyStokes->block (0, 0);
537 elements (M_ETuFESpace->mesh() ),
544 value (-1.0) *phi_j * div (phi_i)
548 >> NSMatrixSteadyStokes->block (0, 1);
551 elements (M_ETuFESpace->mesh() ),
558 value (1.0) *phi_i * div (phi_j)
561 >> NSMatrixSteadyStokes->block (1, 0);
563 NSMatrixSteadyStokes->globalAssemble();
566 elements (M_ETuFESpace->mesh() ),
575 * ( value (alpha / dt) * dot (phi_i, phi_j) )
578 >> NSMatrixConstant->block (0, 0);
581 integrate ( boundary (M_ETuFESpace->mesh(), WALL),
588 ( value (M_d->rhos * alpha / dt) * value ( M_ETpFESpace, hSolid ) + value ( M_ETpFESpace, robinExt ) * ( 0.1 + dt ) ) * dot ( phi_j, phi_i )
591 >> NSMatrixConstant->block (0, 0);
596 MatrixSmall<3, 3> Eye;
606 integrate ( boundary (M_ETuFESpace->mesh(), WALL),
614 2 * LameII * value ( M_ETpFESpace, hSolid ) *
615 0.5 * dot ( ( grad (phi_j) + (-1) * grad (phi_j) * outerProduct ( Nface, Nface ) )
616 + transpose (grad (phi_j) + (-1) * grad (phi_j) * outerProduct ( Nface, Nface ) ),
617 ( grad (phi_i) + ( (-1) * grad (phi_i) * outerProduct ( Nface, Nface ) ) ) ) +
619 ( dt / alpha ) * value ( M_ETpFESpace, hSolid ) *
620 LameI * dot ( value ( Eye ) , ( grad (phi_j) + (-1) * grad (phi_j) * outerProduct ( Nface, Nface ) ) )
621 * dot ( value ( Eye ) , ( grad (phi_i) + (-1) * grad (phi_i) * outerProduct ( Nface, Nface ) ) )
624 >> NSMatrixConstant->block (0, 0);
628 *NSMatrixConstant += *NSMatrixSteadyStokes;
629 NSMatrixConstant->globalAssemble();
632 M_ipStabilization.setFeSpaceVelocity ( *M_uFESpace );
633 M_ipStabilization.setViscosity ( M_d->nu );
636 M_ipStabilization.setGammaBeta ( dataFile (
"ipstab/gammaBeta", 1.0) );
637 M_ipStabilization.setGammaDiv ( dataFile (
"ipstab/gammaDiv", 0.2) );
638 M_ipStabilization.setGammaPress ( dataFile (
"ipstab/gammaPress", 0.5) );
756 exporter.postProcess (t0);
759 while ( currentTime < tFinal)
761 LifeChrono ChronoIteration;
762 ChronoIteration.start();
769 std::cout << std::endl;
773 std::cout <<
"----------------------------" << std::endl;
777 std::cout <<
" Time : " << currentTime << std::endl;
781 std::cout <<
" Iter : " << niter << std::endl;
785 std::cout <<
"----------------------------" << std::endl;
789 std::cout << std::endl;
793 fluidTimeAdvance.bdfVelocity().extrapolation ( velocityExtrapolated );
795 velocityBdfRHS = fluidTimeAdvance.bdfVelocity().rhsContributionFirstDerivative();
798 dispTimeAdvance.extrapolation ( dispExtrapolated );
800 dispBdfRHS = dispTimeAdvance.rhsContributionFirstDerivative();
802 dtDisp = ( alpha / dt ) * dispSolution - dispTimeAdvance.rhsContributionFirstDerivative();
804 std::shared_ptr<matrix_block_type> NSMatrix (
new matrix_block_type ( M_ETuFESpace->map() | M_ETpFESpace->map() | fluxMap ) );
807 #define DIVDIV_TEST value(NSdivdiv) * h_K * div(phi_i) 809 #define SUPG_TEST value(NSSupg) * h_K * (grad(phi_i)*eval(normalize,value(M_ETuFESpace,velocitySolution))) 811 #define PSPG_TEST value(NSPspg) * h_K * grad(phi_i) 813 #define TRANSP_GRADGRAD grad(phi_j) * ( grad(M_ETuFESpace, dispExtrapolated) ) * ( Eye + (-1
) * outerProduct(Nface, Nface) ) 817 std::cout <<
"[Navier-Stokes] Assembling the matrix ... " << std::flush;
820 LifeChrono ChronoItem;
824 std::shared_ptr<NormalizeFct> normalize (
new NormalizeFct);
828 elements (M_ETuFESpace->mesh() ),
836 * ( dot (grad (phi_j) * value (M_ETuFESpace, velocityExtrapolated) , phi_i) )
839 >> NSMatrix->block (0, 0);
842 if (M_d->stabilization ==
"sup")
846 elements (M_ETuFESpace->mesh() ),
854 grad (phi_j) *value (M_ETuFESpace, velocityExtrapolated) * M_d->density
855 + value (alpha / dt) * M_d->density * phi_j
864 >> NSMatrix->block (0, 0);
868 elements (M_ETuFESpace->mesh() ),
878 >> NSMatrix->block (0, 1);
882 elements (M_ETuFESpace->mesh() ),
890 grad (phi_j) *value (M_ETuFESpace, velocityExtrapolated) * value ( M_d->density ) + value (1.0 / dt) * value ( M_d->density ) * phi_j
893 >> NSMatrix->block (1, 0);
897 elements (M_ETuFESpace->mesh() ),
910 >> NSMatrix->block (1, 1);
915 if ( M_d->transpirationOrder == 1 )
922 integrate ( boundary (M_ETuFESpace->mesh(), WALL),
930 2 * LameII * value ( M_ETpFESpace, hSolid ) *
933 ( grad (phi_i) + ( (-1) * grad (phi_i) * outerProduct ( Nface, Nface ) ) ) ) +
936 LameI * value ( M_ETpFESpace, hSolid ) * dot ( value ( Eye ) ,
TRANSP_GRADGRAD )
937 * dot ( value ( Eye ) , ( grad (phi_i) + (-1) * grad (phi_i) * outerProduct ( Nface, Nface ) ) )
940 >> NSMatrix->block (0, 0);
943 integrate ( boundary (M_ETuFESpace->mesh(), WALL),
950 value (M_d->rhos* alpha / dt) * value ( M_ETpFESpace, hSolid) * dot ( grad (phi_j) * value ( M_ETuFESpace, dispExtrapolated) , phi_i )
951 + dot ( grad (phi_j) * value ( M_ETuFESpace, dtDisp ) , phi_i )
952 + value ( M_ETpFESpace, robinExt ) * ( 0.1 + dt / alpha ) * dot ( grad (phi_j) * value ( M_ETuFESpace, dispExtrapolated) , phi_i )
955 >> NSMatrix->block (0, 0);
964 if (M_d->stabilization ==
"ip")
967 std::shared_ptr<matrix_type> stabMatrix (
new matrix_type ( fullMap ) );
968 M_ipStabilization.apply ( *stabMatrix, velocityExtrapolated,
false );
969 stabMatrix->globalAssemble();
970 *NSMatrix += *stabMatrix;
978 std::cout << ChronoItem.diff() <<
" s" << std::endl;
984 std::cout <<
"[Navier-Stokes] Adding constant parts ... " << std::flush;
988 *NSMatrix += *NSMatrixConstant;
993 std::cout << ChronoItem.diff() <<
" s" << std::endl;
999 std::cout <<
"[Navier-Stokes] Assembling the rhs ... " << std::flush;
1003 vector_block_type NSRhs ( M_ETuFESpace->map() | M_ETpFESpace->map() | fluxMap, Repeated );
1007 std::shared_ptr<NormalizeFct> normalize (
new NormalizeFct);
1012 elements (M_ETuFESpace->mesh() ),
1019 M_d->density * dot (value (M_ETuFESpace, velocityBdfRHS), phi_i )
1024 if (M_d->stabilization ==
"sup")
1028 elements (M_ETuFESpace->mesh() ),
1036 M_d->density * value (M_ETuFESpace, velocityBdfRHS)
1043 elements (M_ETuFESpace->mesh() ),
1052 M_d->density * value (M_ETuFESpace, velocityBdfRHS)
1065 std::cout << ChronoItem.diff() <<
" s" << std::endl;
1070 std::cout <<
"[Navier-Stokes] Boundary Intergrals in the rhs ... " << std::flush;
1077 integrate ( boundary (M_ETuFESpace->mesh(), WALL),
1083 value (-1) * ( dt / alpha ) *
1084 2 * LameII * value ( M_ETpFESpace, hSolid ) *
1085 0.5 * dot ( ( grad (M_ETuFESpace, dispBdfRHS ) + (-1) * grad (M_ETuFESpace, dispBdfRHS ) * outerProduct ( Nface, Nface ) )
1086 + transpose (grad (M_ETuFESpace, dispBdfRHS ) + (-1) * grad (M_ETuFESpace, dispBdfRHS ) * outerProduct ( Nface, Nface ) ),
1087 ( grad (phi_i) + ( (-1) * grad (phi_i) * outerProduct ( Nface, Nface ) ) ) ) +
1089 value (-1) * ( dt / alpha ) *
1090 LameI * value ( M_ETpFESpace, hSolid ) * dot ( value ( Eye ) , ( grad (M_ETuFESpace, dispBdfRHS ) + (-1) * grad (M_ETuFESpace, dispBdfRHS ) * outerProduct ( Nface, Nface ) ) )
1091 * dot ( value ( Eye ) , ( grad (phi_i) + (-1) * grad (phi_i) * outerProduct ( Nface, Nface ) ) )
1092 ) >> NSRhs.block (0);
1095 boundary (M_ETuFESpace->mesh(), WALL),
1102 ( value ( M_ETpFESpace, hSolid ) * M_d->rhos * alpha) * dot (value (M_ETuFESpace, velocityBdfRHS), phi_i )
1103 - dt * dot ( value ( M_ETpFESpace, robinExt) * value (M_ETuFESpace, dispBdfRHS ) , phi_i )
1110 if ( M_d->transpirationOrder == 1 )
1116 boundary (M_ETuFESpace->mesh(), WALL),
1123 ( value ( M_ETpFESpace, hSolid) * M_d->rhos * alpha) * dot (grad (M_ETuFESpace, velocityBdfRHS) * value ( M_ETuFESpace, dispExtrapolated ), phi_i )
1134 std::cout << ChronoItem.diff() <<
" s" << std::endl;
1139 std::cout <<
"[Navier-Stokes] Closing the matrix and the rhs ... " << std::flush;
1144 NSMatrix->globalAssemble();
1146 NSRhs.globalAssemble();
1154 std::cout << ChronoItem.diff() <<
" s" << std::endl;
1160 std::cout <<
"[Navier-Stokes] Applying boundary conditions ... " << std::flush;
1163 bcHFluid.bcUpdate ( *meshPart.meshPartition(), M_uFESpace->feBd(), M_uFESpace->dof() );
1165 std::shared_ptr<matrix_type> NSMatrixNoBlock (
new matrix_type ( fullMap ) );
1166 *NSMatrixNoBlock += *NSMatrix;
1167 NSMatrixNoBlock->globalAssemble();
1168 bcManage (*NSMatrixNoBlock, NSRhsUnique,
1169 *M_uFESpace->mesh(), M_uFESpace->dof(),
1170 bcHFluid, M_uFESpace->feBd(), 1.0, currentTime);
1175 std::cout << ChronoItem.diff() <<
" s" << std::endl;
1180 std::cout <<
"[Navier-Stokes] Solving the system " << std::endl;
1183 NSSolver.setMatrix (*NSMatrixNoBlock);
1185 NSSolver.solveSystem (NSRhsUnique, NSSolution, NSMatrixNoBlock);
1187 fluidTimeAdvance.bdfVelocity().shiftRight ( NSSolution );
1189 velocitySolution.subset (NSSolution);
1191 vector_type dispInterface (M_interfaceMap, Repeated);
1193 dispInterface
= dt / alpha
* ( velocitySolution
+ dispBdfRHS );
1195 dispSolution
*= 0.0;
1197 dispSolution.subset (dispInterface, *M_interfaceMap, 0, 0);
1199 dispTimeAdvance.shiftRight ( dispSolution );
1201 fluidTimeAdvance.bdfVelocity().updateRHSContribution ( oseenData->dataTime()->timeStep() );
1202 dispTimeAdvance.updateRHSContribution (oseenData->dataTime()->timeStep() );
1204 *velAndPressureExporter = NSSolution;
1205 *dispExporter = dispSolution;
1209 if (niter % exportEach == 0)
1211 exporter.postProcess (currentTime);
1214 ChronoIteration.stop();
1217 std::cout << std::endl <<
" Total iteration time : " << ChronoIteration.diff() <<
" s" << std::endl;
1223 exporter.closeFile();
1230 Displayer disp (M_d->comm);
1231 disp.leaderPrint (
"Building the Interface Map ... ");
1233 std::vector<
int> dofInterfaceFluid;
1235 typedef std::map<ID, ID>::const_iterator iterator_Type;
1238 dofInterfaceFluid.reserve ( locDofMap.size() );
1240 for (UInt dim = 0; dim < nDimensions; ++dim)
1241 for ( iterator_Type i = locDofMap.begin(); i != locDofMap.end(); ++i )
1243 dofInterfaceFluid.push_back (i->second + dim * dof.numTotalDof() );
1246 int* pointerToDofs (0);
1247 if (dofInterfaceFluid.size() > 0)
1249 pointerToDofs = &dofInterfaceFluid[0];
1252 M_interfaceMap.reset (
new MapEpetra ( -1,
1253 static_cast<
int> (dofInterfaceFluid.size() ),
1256 disp.leaderPrint (
"done\n");
1257 M_d->comm->Barrier();
VectorEpetra operator*(const VectorEpetra::data_type &scalar, const VectorEpetra &vector)
double operator()(const char *VarName, const double &Default) const
VectorEpetra(const VectorEpetra &vector, const MapEpetraType &mapType)
Copy constructor.
RegionMesh< LinearTetra > mesh_type
const QuadratureRule quadRuleTria4pt(pt_tria_4pt, 3, "Quadrature rule 4 points on a triangle", TRIANGLE, 4, 3)
std::shared_ptr< vector_type > vectorPtr_type
GetPot(const int argc_, char **argv_, const char *FieldSeparator=0x0)
std::shared_ptr< Epetra_Comm > comm
Real nu
viscosity (in m^2/s)
Real D
diameter of the cylinder (in m)
VectorEpetra(const MapEpetra &map, const MapEpetraType &mapType=Unique, const combineMode_Type combineMode=Add)
Constructor - Using Maps.
void updateInverseJacobian(const UInt &iQuadPt)
Epetra_Import const & importer()
Getter for the Epetra_Import.
const VectorEpetra operator+(const VectorEpetra &vector) const
Addition operator.
std::shared_ptr< std::vector< Int > > M_isOnProc
class TimeAdvanceBDF - Backward differencing formula time discretization for the first and the second...
MeshData - class for handling spatial discretization.
std::string stabilization
double Real
Generic real data.
ETRobinMembraneSolver(int argc, char **argv)
int operator()(const char *VarName, int Default) const
VectorEpetraStructured vector_block_type
std::function< Real(Real const &, Real const &, Real const &, Real const &, ID const &) > fct_type
VectorEpetra & operator*=(const data_type &scalar)
Multiplication operator.
VectorEpetra & operator=(const VectorEpetra &vector)
Affectation operator.
Real H
height and width of the domain (in m)
uint32_type UInt
generic unsigned integer (used mainly for addressing)
std::string data_file_name