| 1942 | } // correctVelocityOnLagrangianMesh |
| 1943 | |
| 1944 | void |
| 1945 | ConstraintIBMethod::applyProjection() |
| 1946 | { |
| 1947 | const int coarsest_ln = 0; |
| 1948 | const int finest_ln = d_hierarchy->getFinestLevelNumber(); |
| 1949 | |
| 1950 | // Allocate temporary data. |
| 1951 | ComponentSelector scratch_idxs; |
| 1952 | scratch_idxs.setFlag(d_phi_idx); |
| 1953 | scratch_idxs.setFlag(d_Div_u_scratch_idx); |
| 1954 | for (int ln = coarsest_ln; ln <= finest_ln; ++ln) |
| 1955 | { |
| 1956 | Pointer<PatchLevel<NDIM>> level = d_hierarchy->getPatchLevel(ln); |
| 1957 | level->allocatePatchData(scratch_idxs, d_FuRMoRP_new_time); |
| 1958 | } |
| 1959 | |
| 1960 | // Compute div U before applying the projection operator. |
| 1961 | const bool U_current_cf_bdry_synch = true; |
| 1962 | getHierarchyMathOps()->div(d_Div_u_scratch_idx, |
| 1963 | d_Div_u_var, // dst |
| 1964 | +1.0, // alpha |
| 1965 | d_u_fluidSolve_idx, |
| 1966 | Pointer<SideVariable<NDIM, double>>(d_u_fluidSolve_var), // src |
| 1967 | d_no_fill_op, // src_bdry_fill |
| 1968 | d_FuRMoRP_new_time, // src_bdry_fill_time |
| 1969 | U_current_cf_bdry_synch); // src_cf_bdry_synch |
| 1970 | |
| 1971 | if (d_do_log) |
| 1972 | { |
| 1973 | const double Div_u_norm_1 = d_hier_cc_data_ops->L1Norm(d_Div_u_scratch_idx, d_wgt_cc_idx); |
| 1974 | const double Div_u_norm_2 = d_hier_cc_data_ops->L2Norm(d_Div_u_scratch_idx, d_wgt_cc_idx); |
| 1975 | const double Div_u_norm_oo = d_hier_cc_data_ops->maxNorm(d_Div_u_scratch_idx, d_wgt_cc_idx); |
| 1976 | tbox::plog << d_object_name << "::applyProjection():\n" |
| 1977 | << " performing velocity correction projection\n" |
| 1978 | << " before projection:\n" |
| 1979 | << " ||Div U||_1 = " << Div_u_norm_1 << "\n" |
| 1980 | << " ||Div U||_2 = " << Div_u_norm_2 << "\n" |
| 1981 | << " ||Div U||_oo = " << Div_u_norm_oo << "\n"; |
| 1982 | } |
| 1983 | |
| 1984 | // Setup the solver vectors. |
| 1985 | d_hier_cc_data_ops->setToScalar(d_phi_idx, 0.0, false); |
| 1986 | d_hier_cc_data_ops->scale(d_Div_u_scratch_idx, -1.0, d_Div_u_scratch_idx); |
| 1987 | const double Div_u_mean = (1.0 / d_volume) * d_hier_cc_data_ops->integral(d_Div_u_scratch_idx, d_wgt_cc_idx); |
| 1988 | d_hier_cc_data_ops->addScalar(d_Div_u_scratch_idx, d_Div_u_scratch_idx, -Div_u_mean); |
| 1989 | |
| 1990 | SAMRAIVectorReal<NDIM, double> sol_vec(d_object_name + "::sol_vec", d_hierarchy, coarsest_ln, finest_ln); |
| 1991 | sol_vec.addComponent(d_phi_var, d_phi_idx, d_wgt_cc_idx, d_hier_cc_data_ops); |
| 1992 | |
| 1993 | SAMRAIVectorReal<NDIM, double> rhs_vec(d_object_name + "::rhs_vec", d_hierarchy, coarsest_ln, finest_ln); |
| 1994 | rhs_vec.addComponent(d_Div_u_var, d_Div_u_scratch_idx, d_wgt_cc_idx, d_hier_cc_data_ops); |
| 1995 | |
| 1996 | // Setup the Poisson solver. |
| 1997 | // Note that here, the delta t is absorbed in the phi term |
| 1998 | d_velcorrection_projection_spec->setCZero(); |
| 1999 | if (!d_rho_is_const) |
| 2000 | { |
| 2001 | // Copy rho from INS integrator and take reciprocal and scale |
nothing calls this directly
no test coverage detected