Commit 45aeea52 authored by Kirill Terekhov's avatar Kirill Terekhov
Browse files

add Navier-Stokes setup for crevice geometry to test suite

parent 7e873868
......@@ -26,12 +26,13 @@ add_executable(test_transform_grid transform_grid.cpp)
add_executable(test_two_wells_3d two_wells_3d.cpp)
add_executable(test_edwards_3dtest4 edwards_3dtest4.cpp)
add_executable(test_discontinuous_4zones discontinuous_4zones.cpp)
add_executable(test_linear_sol linear_sol.cpp)
add_executable(test_ns_linear ns_linear.cpp)
add_executable(test_linear_sol linear_sol.cpp)
add_executable(test_ns_linear ns_linear.cpp)
add_executable(test_ns_cavity ns_cavity.cpp)
add_executable(test_ns_pousielle ns_pousielle.cpp)
add_executable(test_ns_backward_step ns_backward_step.cpp)
add_executable(test_ns_turek ns_turek.cpp)
add_executable(test_ns_crevice ns_crevice.cpp)
target_link_libraries(test_ns_linear inmost)
......@@ -42,7 +43,9 @@ if(USE_MPI)
set_target_properties(test_ns_linear PROPERTIES LINK_FLAGS "${MPI_LINK_FLAGS}")
endif()
endif(USE_MPI)
install(TARGETS test_ns_linear EXPORT projects-targets RUNTIME DESTINATION bin/TestSuite)
install(TARGETS test_ns_linear EXPORT projects-targets RUNTIME DESTINATION bin/TestSuite)
target_link_libraries(test_ns_cavity inmost)
if(USE_MPI)
message("linking test_ns_cavity with MPI")
......@@ -72,8 +75,19 @@ if(USE_MPI)
set_target_properties(test_ns_turek PROPERTIES LINK_FLAGS "${MPI_LINK_FLAGS}")
endif()
endif(USE_MPI)
install(TARGETS test_ns_turek EXPORT projects-targets RUNTIME DESTINATION bin/TestSuite)
install(TARGETS test_ns_turek EXPORT projects-targets RUNTIME DESTINATION bin/TestSuite)
target_link_libraries(test_ns_crevice inmost)
if(USE_MPI)
message("linking test_ns_cavity with MPI")
target_link_libraries(test_ns_crevice ${MPI_LIBRARIES})
if(MPI_LINK_FLAGS)
set_target_properties(test_ns_crevice PROPERTIES LINK_FLAGS "${MPI_LINK_FLAGS}")
endif()
endif(USE_MPI)
install(TARGETS test_ns_crevice EXPORT projects-targets RUNTIME DESTINATION bin/TestSuite)
target_link_libraries(test_ns_backward_step inmost)
if(USE_MPI)
message("linking test_ns_backward_step with MPI")
......@@ -83,7 +97,7 @@ if(USE_MPI)
endif()
endif(USE_MPI)
install(TARGETS test_ns_backward_step EXPORT projects-targets RUNTIME DESTINATION bin/TestSuite)
target_link_libraries(test_single_well inmost)
......@@ -96,7 +110,7 @@ if(USE_MPI)
endif(USE_MPI)
install(TARGETS test_single_well EXPORT projects-targets RUNTIME DESTINATION bin/TestSuite)
target_link_libraries(test_circular_perm inmost)
target_link_libraries(test_circular_perm inmost)
if(USE_MPI)
message("linking test_circular_perm with MPI")
target_link_libraries(test_circular_perm ${MPI_LIBRARIES})
......@@ -104,7 +118,8 @@ if(USE_MPI)
set_target_properties(test_circular_perm PROPERTIES LINK_FLAGS "${MPI_LINK_FLAGS}")
endif()
endif(USE_MPI)
install(TARGETS test_circular_perm EXPORT projects-targets RUNTIME DESTINATION bin/TestSuite)
install(TARGETS test_circular_perm EXPORT projects-targets RUNTIME DESTINATION bin/TestSuite)
target_link_libraries(test_channels_perm inmost)
......@@ -115,7 +130,8 @@ if(USE_MPI)
set_target_properties(test_channels_perm PROPERTIES LINK_FLAGS "${MPI_LINK_FLAGS}")
endif()
endif(USE_MPI)
install(TARGETS test_channels_perm EXPORT projects-targets RUNTIME DESTINATION bin/TestSuite)
install(TARGETS test_channels_perm EXPORT projects-targets RUNTIME DESTINATION bin/TestSuite)
target_link_libraries(test_locking_perm inmost)
......@@ -125,8 +141,9 @@ if(USE_MPI)
if(MPI_LINK_FLAGS)
set_target_properties(test_locking_perm PROPERTIES LINK_FLAGS "${MPI_LINK_FLAGS}")
endif()
endif(USE_MPI)
install(TARGETS test_locking_perm EXPORT projects-targets RUNTIME DESTINATION bin/TestSuite)
endif(USE_MPI)
install(TARGETS test_locking_perm EXPORT projects-targets RUNTIME DESTINATION bin/TestSuite)
target_link_libraries(test_fvca5_test1_1 inmost)
if(USE_MPI)
......@@ -136,7 +153,8 @@ if(USE_MPI)
set_target_properties(test_fvca5_test1_1 PROPERTIES LINK_FLAGS "${MPI_LINK_FLAGS}")
endif()
endif(USE_MPI)
install(TARGETS test_fvca5_test1_1 EXPORT projects-targets RUNTIME DESTINATION bin/TestSuite)
install(TARGETS test_fvca5_test1_1 EXPORT projects-targets RUNTIME DESTINATION bin/TestSuite)
target_link_libraries(test_fvca5_test1_2 inmost)
if(USE_MPI)
......@@ -145,8 +163,9 @@ if(USE_MPI)
if(MPI_LINK_FLAGS)
set_target_properties(test_fvca5_test1_2 PROPERTIES LINK_FLAGS "${MPI_LINK_FLAGS}")
endif()
endif(USE_MPI)
install(TARGETS test_fvca5_test1_2 EXPORT projects-targets RUNTIME DESTINATION bin/TestSuite)
endif(USE_MPI)
install(TARGETS test_fvca5_test1_2 EXPORT projects-targets RUNTIME DESTINATION bin/TestSuite)
target_link_libraries(test_fvca5_test3 inmost)
......@@ -156,10 +175,11 @@ if(USE_MPI)
if(MPI_LINK_FLAGS)
set_target_properties(test_fvca5_test3 PROPERTIES LINK_FLAGS "${MPI_LINK_FLAGS}")
endif()
endif(USE_MPI)
install(TARGETS test_fvca5_test3 EXPORT projects-targets RUNTIME DESTINATION bin/TestSuite)
endif(USE_MPI)
install(TARGETS test_fvca5_test3 EXPORT projects-targets RUNTIME DESTINATION bin/TestSuite)
target_link_libraries(test_fvca5_test4 inmost)
target_link_libraries(test_fvca5_test4 inmost)
if(USE_MPI)
message("linking test_fvca5_test4 with MPI")
target_link_libraries(test_fvca5_test4 ${MPI_LIBRARIES})
......@@ -167,7 +187,8 @@ if(USE_MPI)
set_target_properties(test_fvca5_test4 PROPERTIES LINK_FLAGS "${MPI_LINK_FLAGS}")
endif()
endif(USE_MPI)
install(TARGETS test_fvca5_test4 EXPORT projects-targets RUNTIME DESTINATION bin/TestSuite)
install(TARGETS test_fvca5_test4 EXPORT projects-targets RUNTIME DESTINATION bin/TestSuite)
target_link_libraries(test_fvca5_test5 inmost)
if(USE_MPI)
......@@ -176,8 +197,9 @@ if(USE_MPI)
if(MPI_LINK_FLAGS)
set_target_properties(test_fvca5_test5 PROPERTIES LINK_FLAGS "${MPI_LINK_FLAGS}")
endif()
endif(USE_MPI)
install(TARGETS test_fvca5_test5 EXPORT projects-targets RUNTIME DESTINATION bin/TestSuite)
endif(USE_MPI)
install(TARGETS test_fvca5_test5 EXPORT projects-targets RUNTIME DESTINATION bin/TestSuite)
target_link_libraries(test_fvca5_test6 inmost)
if(USE_MPI)
......@@ -187,7 +209,8 @@ if(USE_MPI)
set_target_properties(test_fvca5_test6 PROPERTIES LINK_FLAGS "${MPI_LINK_FLAGS}")
endif()
endif(USE_MPI)
install(TARGETS test_fvca5_test6 EXPORT projects-targets RUNTIME DESTINATION bin/TestSuite)
install(TARGETS test_fvca5_test6 EXPORT projects-targets RUNTIME DESTINATION bin/TestSuite)
target_link_libraries(test_fvca5_test7 inmost)
if(USE_MPI)
......@@ -197,7 +220,8 @@ if(USE_MPI)
set_target_properties(test_fvca5_test7 PROPERTIES LINK_FLAGS "${MPI_LINK_FLAGS}")
endif()
endif(USE_MPI)
install(TARGETS test_fvca5_test7 EXPORT projects-targets RUNTIME DESTINATION bin/TestSuite)
install(TARGETS test_fvca5_test7 EXPORT projects-targets RUNTIME DESTINATION bin/TestSuite)
target_link_libraries(test_fvca5_test7_adv inmost)
if(USE_MPI)
......@@ -207,7 +231,8 @@ if(USE_MPI)
set_target_properties(test_fvca5_test7_adv PROPERTIES LINK_FLAGS "${MPI_LINK_FLAGS}")
endif()
endif(USE_MPI)
install(TARGETS test_fvca5_test7_adv EXPORT projects-targets RUNTIME DESTINATION bin/TestSuite)
install(TARGETS test_fvca5_test7_adv EXPORT projects-targets RUNTIME DESTINATION bin/TestSuite)
target_link_libraries(test_fvca5_test8 inmost)
if(USE_MPI)
......@@ -217,7 +242,8 @@ if(USE_MPI)
set_target_properties(test_fvca5_test8 PROPERTIES LINK_FLAGS "${MPI_LINK_FLAGS}")
endif()
endif(USE_MPI)
install(TARGETS test_fvca5_test8 EXPORT projects-targets RUNTIME DESTINATION bin/TestSuite)
install(TARGETS test_fvca5_test8 EXPORT projects-targets RUNTIME DESTINATION bin/TestSuite)
target_link_libraries(test_fvca5_test9 inmost)
if(USE_MPI)
......@@ -227,7 +253,8 @@ if(USE_MPI)
set_target_properties(test_fvca5_test9 PROPERTIES LINK_FLAGS "${MPI_LINK_FLAGS}")
endif()
endif(USE_MPI)
install(TARGETS test_fvca5_test9 EXPORT projects-targets RUNTIME DESTINATION bin/TestSuite)
install(TARGETS test_fvca5_test9 EXPORT projects-targets RUNTIME DESTINATION bin/TestSuite)
target_link_libraries(test_wugao_test2 inmost)
if(USE_MPI)
......@@ -237,7 +264,8 @@ if(USE_MPI)
set_target_properties(test_wugao_test2 PROPERTIES LINK_FLAGS "${MPI_LINK_FLAGS}")
endif()
endif(USE_MPI)
install(TARGETS test_wugao_test2 EXPORT projects-targets RUNTIME DESTINATION bin/TestSuite)
install(TARGETS test_wugao_test2 EXPORT projects-targets RUNTIME DESTINATION bin/TestSuite)
target_link_libraries(test_wugao_test3 inmost)
......@@ -248,7 +276,8 @@ if(USE_MPI)
set_target_properties(test_wugao_test3 PROPERTIES LINK_FLAGS "${MPI_LINK_FLAGS}")
endif()
endif(USE_MPI)
install(TARGETS test_wugao_test3 EXPORT projects-targets RUNTIME DESTINATION bin/TestSuite)
install(TARGETS test_wugao_test3 EXPORT projects-targets RUNTIME DESTINATION bin/TestSuite)
target_link_libraries(test_wugao_test3_adv inmost)
if(USE_MPI)
......@@ -258,7 +287,8 @@ if(USE_MPI)
set_target_properties(test_wugao_test3_adv PROPERTIES LINK_FLAGS "${MPI_LINK_FLAGS}")
endif()
endif(USE_MPI)
install(TARGETS test_wugao_test3_adv EXPORT projects-targets RUNTIME DESTINATION bin/TestSuite)
install(TARGETS test_wugao_test3_adv EXPORT projects-targets RUNTIME DESTINATION bin/TestSuite)
target_link_libraries(test_wugao_test4 inmost)
......@@ -269,7 +299,8 @@ if(USE_MPI)
set_target_properties(test_wugao_test4 PROPERTIES LINK_FLAGS "${MPI_LINK_FLAGS}")
endif()
endif(USE_MPI)
install(TARGETS test_wugao_test4 EXPORT projects-targets RUNTIME DESTINATION bin/TestSuite)
install(TARGETS test_wugao_test4 EXPORT projects-targets RUNTIME DESTINATION bin/TestSuite)
target_link_libraries(test_adv_test00 inmost)
if(USE_MPI)
......@@ -279,7 +310,8 @@ if(USE_MPI)
set_target_properties(test_adv_test00 PROPERTIES LINK_FLAGS "${MPI_LINK_FLAGS}")
endif()
endif(USE_MPI)
install(TARGETS test_adv_test00 EXPORT projects-targets RUNTIME DESTINATION bin/TestSuite)
install(TARGETS test_adv_test00 EXPORT projects-targets RUNTIME DESTINATION bin/TestSuite)
target_link_libraries(test_adv_test01 inmost)
if(USE_MPI)
......@@ -289,7 +321,8 @@ if(USE_MPI)
set_target_properties(test_adv_test01 PROPERTIES LINK_FLAGS "${MPI_LINK_FLAGS}")
endif()
endif(USE_MPI)
install(TARGETS test_adv_test01 EXPORT projects-targets RUNTIME DESTINATION bin/TestSuite)
install(TARGETS test_adv_test01 EXPORT projects-targets RUNTIME DESTINATION bin/TestSuite)
target_link_libraries(test_adv_test02 inmost)
......@@ -300,7 +333,8 @@ if(USE_MPI)
set_target_properties(test_adv_test02 PROPERTIES LINK_FLAGS "${MPI_LINK_FLAGS}")
endif()
endif(USE_MPI)
install(TARGETS test_adv_test02 EXPORT projects-targets RUNTIME DESTINATION bin/TestSuite)
install(TARGETS test_adv_test02 EXPORT projects-targets RUNTIME DESTINATION bin/TestSuite)
target_link_libraries(test_adv_test03 inmost)
......@@ -311,7 +345,8 @@ if(USE_MPI)
set_target_properties(test_adv_test03 PROPERTIES LINK_FLAGS "${MPI_LINK_FLAGS}")
endif()
endif(USE_MPI)
install(TARGETS test_adv_test03 EXPORT projects-targets RUNTIME DESTINATION bin/TestSuite)
install(TARGETS test_adv_test03 EXPORT projects-targets RUNTIME DESTINATION bin/TestSuite)
......@@ -322,8 +357,9 @@ if(USE_MPI)
if(MPI_LINK_FLAGS)
set_target_properties(test_transform_grid PROPERTIES LINK_FLAGS "${MPI_LINK_FLAGS}")
endif()
endif(USE_MPI)
install(TARGETS test_transform_grid EXPORT projects-targets RUNTIME DESTINATION bin/TestSuite)
endif(USE_MPI)
install(TARGETS test_transform_grid EXPORT projects-targets RUNTIME DESTINATION bin/TestSuite)
target_link_libraries(test_two_wells_3d inmost)
if(USE_MPI)
......@@ -333,7 +369,8 @@ if(USE_MPI)
set_target_properties(test_two_wells_3d PROPERTIES LINK_FLAGS "${MPI_LINK_FLAGS}")
endif()
endif(USE_MPI)
install(TARGETS test_two_wells_3d EXPORT projects-targets RUNTIME DESTINATION bin/TestSuite)
install(TARGETS test_two_wells_3d EXPORT projects-targets RUNTIME DESTINATION bin/TestSuite)
target_link_libraries(test_edwards_3dtest4 inmost)
if(USE_MPI)
......@@ -343,7 +380,8 @@ if(USE_MPI)
set_target_properties(test_edwards_3dtest4 PROPERTIES LINK_FLAGS "${MPI_LINK_FLAGS}")
endif()
endif(USE_MPI)
install(TARGETS test_edwards_3dtest4 EXPORT projects-targets RUNTIME DESTINATION bin/TestSuite)
install(TARGETS test_edwards_3dtest4 EXPORT projects-targets RUNTIME DESTINATION bin/TestSuite)
target_link_libraries(test_discontinuous_4zones inmost)
if(USE_MPI)
......@@ -364,6 +402,8 @@ if(USE_MPI)
set_target_properties(test_linear_sol PROPERTIES LINK_FLAGS "${MPI_LINK_FLAGS}")
endif()
endif(USE_MPI)
install(TARGETS test_linear_sol EXPORT projects-targets RUNTIME DESTINATION bin/TestSuite)
install(TARGETS test_linear_sol EXPORT projects-targets RUNTIME DESTINATION bin/TestSuite)
install(FILES readme.txt DESTINATION bin/TestSuite)
install(FILES readme.txt DESTINATION bin/TestSuite)
#include "inmost.h"
using namespace INMOST;
// use ADMFD or ADVDIFF to solve for phi
//setup BC
//setup on mesh:
//
// FORCE - 3 entries
//
// BOUNDARY_CONDITION_VELOCITY - 7 entries
// r = (a5,a6,a7)
// n.(a1*u + a2*t) = n.r
// (I - nn.)(a3*u + a4*t) = (I-nn.)r
//
// BOUNDARY_CONDITION_PRESSURE - 1 entry
//
// REFERENCE_VELOCITY - 3 entries
//
// REFERENCE_PRESSURE - 1 entry
//
// BOUNDARY_CONDTION - 3 entries (for calculation of phi and measures of drag and lift)
typedef Storage::real real;
const double eps = 1.0e-5;
int main(int argc, char ** argv)
{
if( argc < 2 )
{
std::cout << "Usage: " << argv[0] << " mesh [mesh_out=grid_out.pmf]" << std::endl;
return 0;
}
Mesh * m = new Mesh;
m->SetFileOption("VERBOSITY","2");
try
{
m->Load(argv[1]);
}
catch(...)
{
std::cout << "Cannot load the mesh " << argv[1] << std::endl;
return -1;
}
std::string fout = "grid_out.pmf";
double Umax = 2.25;
int fix_cylinder = 0;
if( argc > 2 ) fout = std::string(argv[2]);
if( argc > 3 ) Umax = atof(argv[3]);
if( argc > 4 ) fix_cylinder = atoi(argv[4]);
double cmax[3] = {-1.0e20,-1.0e20,-1.0e20}, cmin[3] = {1.0e20,1.0e20,1.0e20};
for(Mesh::iteratorNode n = m->BeginNode(); n != m->EndNode(); ++n)
{
Storage::real_array c = n->Coords();
for(int k = 0; k < 3; ++k)
{
if( cmax[k] < c[k] ) cmax[k] = c[k];
if( cmin[k] > c[k] ) cmin[k] = c[k];
}
}
for(int d = 0; d < 3; ++d)
std::cout << d << " " << cmin[d] << ":" << cmax[d] << std::endl;
//TagRealArray force = m->CreateTag("FORCE",DATA_REAL,CELL,NONE,3);
TagRealArray bc = m->CreateTag("BOUNDARY_CONDITION_VELOCITY",DATA_REAL,FACE,FACE,7);
TagReal bcp = m->CreateTag("BOUNDARY_CONDITION_PRESSURE",DATA_REAL,FACE,FACE,1);
TagInteger bb = m->CreateTag("BOUNDARY_BLOOD",DATA_INTEGER,FACE,FACE,1);
TagRealArray uvw = m->CreateTag("UVW",DATA_REAL,CELL,NONE,3);
TagReal p = m->CreateTag("P",DATA_REAL,CELL,NONE,1);
m->self().Real(m->CreateTag("Umax",DATA_REAL,MESH,NONE,1)) = Umax;
//this should not be needed?
for(Mesh::iteratorFace it = m->BeginFace(); it != m->EndFace(); ++it) if( it->Boundary() )
it->FixNormalOrientation();
{ // prepare geometrical data on the mesh
Mesh::GeomParam table;
table[CENTROID] = CELL | FACE; //Compute averaged center of mass
table[NORMAL] = FACE; //Compute normals
table[MEASURE] = CELL | FACE; //Compute volumes and areas
table[BARYCENTER] = CELL | FACE; //Compute volumetric center of mass
m->RemoveGeometricData(table); //Ask to precompute the data
}
for(Mesh::iteratorFace it = m->BeginFace(); it != m->EndFace(); ++it) if( it->Boundary() )
{
double n[3], c[3];
it->UnitNormal(n);
it->Centroid(c);
bb[*it] = 0;
if( fabs(n[0]-1) < 1.0e-3 && c[0] > 1.8+eps) // outflow
{
//~ bcp[*it] = 0;
bc[*it][0] = 0;
bc[*it][1] = 1;
bc[*it][2] = 0;
bc[*it][3] = 1;
bc[*it][4] = 0;
bc[*it][5] = 0;
bc[*it][6] = 0;
}
else if( fabs(n[0]+1) < 1.0e-3 && c[0] < 0.0+eps) //inflow
{
bb[*it] = 1;
bc[*it][0] = 1;
bc[*it][1] = 0;
bc[*it][2] = 1;
bc[*it][3] = 0;
bc[*it][4] = 17.3;
bc[*it][5] = 0;
bc[*it][6] = 0;
}
else if( (fabs(n[1]-1) < 1.0e-3 && c[1] > 1.5-eps) || (fabs(n[2]-1) < 1.0e-3 && c[2] > 0.1-eps) || (fabs(n[2]+1) < 1.0e-3 && c[2] < 0.0+eps) ) //slip wall
{
bc[*it][0] = 1;
bc[*it][1] = 0;
bc[*it][2] = 0;
bc[*it][3] = 1;
bc[*it][4] = 0;
bc[*it][5] = 0;
bc[*it][6] = 0;
}
else //no-slip walls
{
bc[*it][0] = 1;
bc[*it][1] = 0;
bc[*it][2] = 1;
bc[*it][3] = 0;
bc[*it][4] = 0;
bc[*it][5] = 0;
bc[*it][6] = 0;
}
}
std::cout << "Saving output to " << fout << std::endl;
m->Save(fout);
return 0;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment