MCPcopy Create free account
hub / github.com/IBAMR/IBAMR / main

Function main

tests/spread/spread_02.cpp:76–416  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

74}
75
76int
77main(int argc, char** argv)
78{
79 // Initialize IBAMR and libraries. Deinitialization is handled by this object as well.
80 IBTKInit ibtk_init(argc, argv, MPI_COMM_WORLD);
81 const LibMeshInit& init = ibtk_init.getLibMeshInit();
82
83 // suppress warnings caused by using a refinement ratio of 4 and not
84 // setting up coarsening correctly
85 SAMRAI::tbox::Logger::getInstance()->setWarning(false);
86
87 PetscOptionsSetValue(nullptr, "-ksp_rtol", "1e-16");
88 PetscOptionsSetValue(nullptr, "-ksp_atol", "1e-16");
89
90 // prevent a warning about timer initializations
91 TimerManager::createManager(nullptr);
92 {
93 // Parse command line options, set some standard options from the input
94 // file, initialize the restart database (if this is a restarted run),
95 // and enable file logging.
96 Pointer<AppInitializer> app_initializer = new AppInitializer(argc, argv, "IB.log");
97
98 Pointer<Database> input_db = app_initializer->getInputDatabase();
99
100 // Create a simple FE mesh.
101 std::vector<std::unique_ptr<ReplicatedMesh>> meshes;
102 meshes.emplace_back(std::make_unique<ReplicatedMesh>(init.comm(), NDIM));
103 const double dx = input_db->getDouble("DX");
104 const double ds = input_db->getDouble("MFAC") * dx;
105 const std::string elem_str = input_db->getString("ELEM_TYPE");
106 const auto elem_type = Utility::string_to_enum<ElemType>(elem_str);
107
108 // This test only supports one type of mesh.
109 {
110 ReplicatedMesh& mesh = *meshes[0];
111 const double L = input_db->getDouble("L");
112 if (NDIM == 2)
113 MeshTools::Generation::build_square(
114 mesh, int(L / ds), int(L / (4.0 * ds)), 0.0, L, 0.0, L / 4.0, elem_type);
115 else
116 MeshTools::Generation::build_cube(mesh,
117 int(L / ds),
118 int(L / (4.0 * ds)),
119 int(L / (4.0 * ds)),
120 0.0,
121 L,
122 0.0,
123 L / 4.0,
124 0.0,
125 L / 4.0,
126 elem_type);
127
128 // Assign boundary elements to a finer patch level
129 MeshBase::element_iterator el_end = mesh.active_elements_end();
130 for (MeshBase::element_iterator el = mesh.active_elements_begin(); el != el_end; ++el)
131 {
132 const libMesh::Point centroid = (*el)->vertex_average();
133 if (centroid(0) < 0.5)

Callers

nothing calls this directly

Calls 15

exact_forcingFunction · 0.85
print_strings_on_plog_0Function · 0.85
getInputDatabaseMethod · 0.80
getComponentDatabaseMethod · 0.80
regridHierarchyMethod · 0.80
getPatchLevelMethod · 0.80
allocatePatchDataMethod · 0.80
fillDataMethod · 0.80
getIntegratorTimeMethod · 0.80
dof_indicesMethod · 0.80

Tested by

no test coverage detected