1 #include <lifev/navier_stokes_blocks/solver/StabilizationSUPGALE.hpp> 4 #define TAU_M value(1
)/( eval(squareroot,TAU_M_DEN) ) 6 #define TAU_M_DEN_DT value(M_density*M_density)*value(M_bdfOrder*M_bdfOrder)/value(M_timestep * M_timestep) 7 #define TAU_M_DEN_VEL value(M_density*M_density)*dot(value(M_fespaceUETA, beta_km1), G * value(M_fespaceUETA, beta_km1)) 8 #define TAU_M_DEN_VISC ( value(M_C_I)*value(M_viscosity*M_viscosity) *dot (G, G) ) 11 #define TAU_C value(1.0
)/( dot(g, TAU_M*g ) ) 20 StabilizationSUPGALE::StabilizationSUPGALE():
29 void StabilizationSUPGALE::setConstant(
const int & value)
33 else if ( value == 2 )
36 ASSERT(0!=0,
"Please implement a suitable value for M_C_I for your velocity FE order");
39 void StabilizationSUPGALE::buildGraphs()
42 vector_Type u_km1( M_uFESpace->map(), Repeated);
43 vector_Type beta_km1( M_uFESpace->map(), Repeated);
44 vector_Type p_km1( M_pFESpace->map(), Repeated);
45 vector_Type u_bdf( M_uFESpace->map(), Repeated);
57 std::shared_ptr<SquareRoot_SUPGALE> squareroot(
new SquareRoot_SUPGALE());
59 MatrixSmall<3, 3> Eye;
66 using namespace ExpressionAssembly;
69 M_graph_block00.reset (
new Epetra_FECrsGraph (Copy, * (M_uFESpace->map().map (Unique) ), 0) );
70 buildGraph ( elements ( M_uFESpace->mesh() ),
74 TAU_M * value(M_density*M_density) * value(M_alpha/M_timestep) * dot( value(M_fespaceUETA, beta_km1)*grad(phi_i), phi_j )
75 +
TAU_M * value(M_density*M_density) * value(M_alpha/M_timestep) * dot( phi_j*grad(phi_i), value(M_fespaceUETA, u_km1) )
76 -
TAU_M * value(M_density*M_density) * dot( phi_j*grad(phi_i), value(M_fespaceUETA, u_bdf) )
77 +
TAU_M * value(M_density*M_density) * dot( value(M_fespaceUETA, beta_km1)*grad(phi_i), phi_j*grad(M_fespaceUETA, u_km1) )
78 +
TAU_M * value(M_density*M_density) * dot( value(M_fespaceUETA, beta_km1)*grad(phi_i), value(M_fespaceUETA, beta_km1)*grad(phi_j) )
79 +
TAU_M * value(M_density*M_density) * dot( phi_j*grad(phi_i), value(M_fespaceUETA, beta_km1)*grad(M_fespaceUETA, u_km1) )
80 +
TAU_M * value(M_density) * dot( phi_j*grad(phi_i), grad(M_fespacePETA, p_km1) )
81 -
TAU_M * value(M_density*M_viscosity) * dot( value(M_fespaceUETA, beta_km1)*grad(phi_i), laplacian(phi_j) )
82 -
TAU_M * value(M_density*M_viscosity) * dot( phi_j*grad(phi_i), laplacian(M_fespaceUETA, u_km1) )
83 +
TAU_C * div(phi_i)*div(phi_j)
85 M_graph_block00->GlobalAssemble();
86 M_graph_block00->OptimizeStorage();
89 M_graph_block10.reset (
new Epetra_FECrsGraph (Copy, * (M_pFESpace->map().map (Unique) ), 0) );
90 buildGraph ( elements (M_pFESpace->mesh() ),
94 TAU_M * value(M_alpha*M_density/M_timestep) * dot( grad(phi_i), phi_j )
95 +
TAU_M * value(M_density) * dot( grad(M_fespaceUETA, u_km1)*grad(phi_i), phi_j )
96 +
TAU_M * value(M_density) * dot( grad(phi_i), value(M_fespaceUETA, beta_km1)*grad(phi_j) )
97 -
TAU_M * value(M_viscosity) * dot( grad(phi_i), laplacian(phi_j) )
99 M_graph_block10->GlobalAssemble ( * (M_uFESpace->map().map (Unique) ), * (M_pFESpace->map().map (Unique) ) );
100 M_graph_block10->OptimizeStorage();
103 M_graph_block01.reset (
new Epetra_FECrsGraph (Copy, * (M_uFESpace->map().map (Unique) ), 0) );
104 buildGraph ( elements (M_pFESpace->mesh() ),
108 TAU_M * value(M_density) * dot( value(M_fespaceUETA, beta_km1)*grad(phi_i), grad(phi_j) )
109 ) >> M_graph_block01;
110 M_graph_block01->GlobalAssemble ( * (M_pFESpace->map().map (Unique) ), * (M_uFESpace->map().map (Unique) ) );
111 M_graph_block01->OptimizeStorage();
114 M_graph_block11.reset (
new Epetra_FECrsGraph (Copy, * (M_pFESpace->map().map (Unique) ), 0) );
115 buildGraph ( elements (M_pFESpace->mesh() ),
119 TAU_M*dot( grad(phi_i), grad(phi_j) )
120 ) >> M_graph_block11;
121 M_graph_block11->GlobalAssemble ( );
122 M_graph_block11->OptimizeStorage();
126 M_block_00.reset (
new matrix_Type ( M_uFESpace->map(), *M_graph_block00 ) );
128 M_block_00->globalAssemble();
130 M_block_01.reset (
new matrix_Type ( M_uFESpace->map(), *M_graph_block01 ) );
132 M_block_01->globalAssemble( M_pFESpace->mapPtr(), M_uFESpace->mapPtr() );
134 M_block_10.reset (
new matrix_Type ( M_pFESpace->map(), *M_graph_block10 ) );
136 M_block_10->globalAssemble( M_uFESpace->mapPtr(), M_pFESpace->mapPtr() );
138 M_block_11.reset (
new matrix_Type ( M_pFESpace->map(), *M_graph_block11 ) );
140 M_block_11->globalAssemble( );
143 void StabilizationSUPGALE::apply_matrix(
const vector_Type& convective_velocity_previous_newton_step,
144 const vector_Type& velocity_previous_newton_step,
145 const vector_Type& pressure_previous_newton_step,
146 const vector_Type& velocity_rhs)
151 M_block_00.reset (
new matrix_Type ( M_uFESpace->map() ) );
153 M_block_01.reset (
new matrix_Type ( M_uFESpace->map() ) );
155 M_block_10.reset (
new matrix_Type ( M_pFESpace->map() ) );
157 M_block_11.reset (
new matrix_Type ( M_pFESpace->map() ) );
165 vector_Type beta_km1( convective_velocity_previous_newton_step, Repeated);
166 vector_Type u_km1( velocity_previous_newton_step, Repeated);
167 vector_Type p_km1( pressure_previous_newton_step, Repeated);
168 vector_Type u_bdf( velocity_rhs, Repeated);
170 std::shared_ptr<SquareRoot_SUPGALE> squareroot(
new SquareRoot_SUPGALE());
172 MatrixSmall<3, 3> Eye;
178 using namespace ExpressionAssembly;
181 elements(M_uFESpace->mesh()),
185 TAU_M * value(M_density*M_density) * value(M_alpha/M_timestep) * dot( value(M_fespaceUETA, beta_km1)*grad(phi_i), phi_j )
186 +
TAU_M * value(M_density*M_density) * value(M_alpha/M_timestep) * dot( phi_j*grad(phi_i), value(M_fespaceUETA, u_km1) )
187 -
TAU_M * value(M_density*M_density) * dot( phi_j*grad(phi_i), value(M_fespaceUETA, u_bdf) )
188 +
TAU_M * value(M_density*M_density) * dot( value(M_fespaceUETA, beta_km1)*grad(phi_i), phi_j*grad(M_fespaceUETA, u_km1) )
189 +
TAU_M * value(M_density*M_density) * dot( value(M_fespaceUETA, beta_km1)*grad(phi_i), value(M_fespaceUETA, beta_km1)*grad(phi_j) )
190 +
TAU_M * value(M_density*M_density) * dot( phi_j*grad(phi_i), value(M_fespaceUETA, beta_km1)*grad(M_fespaceUETA, u_km1) )
191 +
TAU_M * value(M_density) * dot( phi_j*grad(phi_i), grad(M_fespacePETA, p_km1) )
192 -
TAU_M * value(M_density*M_viscosity) * dot( value(M_fespaceUETA, beta_km1)*grad(phi_i), laplacian(phi_j) )
193 -
TAU_M * value(M_density*M_viscosity) * dot( phi_j*grad(phi_i), laplacian(M_fespaceUETA, u_km1) )
194 +
TAU_C * div(phi_i)*div(phi_j)
196 M_block_00->globalAssemble();
199 elements(M_uFESpace->mesh()),
203 TAU_M * value(M_alpha*M_density/M_timestep) * dot( grad(phi_i), phi_j )
204 +
TAU_M * value(M_density) * dot( grad(phi_i), grad(M_fespaceUETA, u_km1)*phi_j )
205 +
TAU_M * value(M_density) * dot( grad(phi_i), value(M_fespaceUETA, beta_km1)*grad(phi_j) )
206 -
TAU_M * value(M_viscosity) * dot( grad(phi_i), laplacian(phi_j) )
208 M_block_10->globalAssemble( M_uFESpace->mapPtr(), M_pFESpace->mapPtr() );
211 elements(M_uFESpace->mesh()),
215 TAU_M * value(M_density) * dot( value(M_fespaceUETA, beta_km1)*grad(phi_i), grad(phi_j) )
217 M_block_01->globalAssemble( M_pFESpace->mapPtr(), M_uFESpace->mapPtr() );
220 elements(M_uFESpace->mesh()),
224 TAU_M*dot( grad(phi_i), grad(phi_j) )
226 M_block_11->globalAssemble();
230 void StabilizationSUPGALE::apply_vector( vectorPtr_Type& residual_velocity,
231 vectorPtr_Type& residual_pressure,
232 const vector_Type& convective_velocity_previous_newton_step,
233 const vector_Type& velocity_previous_newton_step,
234 const vector_Type& pressure_previous_newton_step,
235 const vector_Type& velocity_rhs)
239 vector_Type beta_km1( convective_velocity_previous_newton_step, Repeated);
240 vector_Type u_km1( velocity_previous_newton_step, Repeated);
241 vector_Type p_km1( pressure_previous_newton_step, Repeated);
242 vector_Type u_bdf( velocity_rhs, Repeated);
244 std::shared_ptr<SquareRoot_SUPGALE> squareroot(
new SquareRoot_SUPGALE());
247 MatrixSmall<3, 3> Eye;
253 using namespace ExpressionAssembly;
256 elements(M_uFESpace->mesh()),
259 TAU_M * value(M_density*M_density)*value(M_alpha/M_timestep) * dot( value(M_fespaceUETA, beta_km1)*grad(phi_i), value(M_fespaceUETA, u_km1) )
260 -
TAU_M * value(M_density*M_density) * dot( value(M_fespaceUETA, beta_km1)*grad(phi_i), value(M_fespaceUETA, u_bdf) )
261 +
TAU_M*value(M_density*M_density)*dot( value(M_fespaceUETA, beta_km1)*grad(phi_i), value(M_fespaceUETA, beta_km1)*grad(M_fespaceUETA, u_km1) )
262 +
TAU_M*value(M_density)*dot( value(M_fespaceUETA, beta_km1)*grad(phi_i), grad(M_fespacePETA, p_km1) )
263 -
TAU_M*value(M_density*M_viscosity)*dot( value(M_fespaceUETA, beta_km1)*grad(phi_i), laplacian(M_fespaceUETA, u_km1) )
264 +
TAU_C*div(phi_i)* trace ( grad(M_fespaceUETA, u_km1) )
266 >> residual_velocity;
269 elements(M_uFESpace->mesh()),
272 TAU_M*value(M_density*M_alpha/M_timestep)*dot( grad(phi_i), value(M_fespaceUETA, u_km1) )
273 -
TAU_M*value(M_density)*dot( grad(phi_i), value(M_fespaceUETA, u_bdf))
274 +
TAU_M*value(M_density)*dot( grad(phi_i), value(M_fespaceUETA, beta_km1)*grad(M_fespaceUETA, u_km1) )
275 +
TAU_M*dot( grad(phi_i), grad(M_fespacePETA,p_km1) )
276 -
TAU_M*value(M_viscosity)*dot(grad(phi_i), laplacian(M_fespaceUETA, u_km1))
278 >> residual_pressure;