[MOAB-dev] commit/MOAB: 4 new changesets
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Tue Nov 12 23:57:54 CST 2013
4 new commits in MOAB:
https://bitbucket.org/fathomteam/moab/commits/31889427adeb/
Changeset: 31889427adeb
Branch: None
User: iulian07
Date: 2013-11-13 06:57:34
Summary: use FileOptions class to set up the arguments
It is much nicer, and it also has help automatically:
for example, diffusion -h does this:
diffusion -h
Simulate a transport problem in a semi-Lagrangian formulation
This program simulates a transport problem on a sphere according to a benchmark from a Nair & Lauritzen paper.
It starts with a partitioned mesh on a sphere, add a tracer, and steps through.
The flow reverses after half time, and it should return to original configuration, if the integration was exact.
Usage: diffusion --help | [options]
Options:
-h [--help] : Show full help text
-g [--gtolerance] <val>: geometric absolute tolerance (used for point concidence on the sphere)
-i [--input_file] <arg>: input mesh file, partitioned
-O [--extra_read_options] <arg>: extra read options
-f [--field_type] <int>: field type-- 1: quasi-smooth; 2: smooth; 3: slotted cylinders (non-smooth)
-n [--num_steps] <int>: number of steps
-w [--write_debug_files]: write debugging files during simulation
-v [--write_velocity_files]: Reorder mesh to group entities by partition
-p [--write_result_in_parallel]: write tracer result files
Affected #: 1 file
diff --git a/tools/mbcslam/diffusion.cpp b/tools/mbcslam/diffusion.cpp
index ed1d120..378473e 100644
--- a/tools/mbcslam/diffusion.cpp
+++ b/tools/mbcslam/diffusion.cpp
@@ -39,6 +39,10 @@ on the sphere; see CSLAM Utils case1
#include "CslamUtils.hpp"
+const char BRIEF_DESC[] =
+ "Simulate a transport problem in a semi-Lagrangian formulation\n";
+std::ostringstream LONG_DESC;
+
// non smooth scalar field
// some input data
double gtol = 1.e-9; // this is for geometry tolerance
@@ -51,7 +55,7 @@ double T = 5;
int case_number = 1; // 1, 2 (non-divergent) 3 divergent
moab::Tag corrTag;
-bool noWrite = false;
+bool writeFiles = false;
bool parallelWrite = false;
bool velocity = false;
int field_type = 1 ; // 1 quasi smooth, 2 - smooth, 3 non-smooth,
@@ -395,7 +399,7 @@ ErrorCode compute_tracer_case1(Interface * mb, Intx2MeshOnSphere & worker, Entit
// lagr and euler are preserved
EntityHandle covering_set;
rval = worker.create_departure_mesh_3rd_alg(lagr_set, covering_set);
- if (!noWrite) // so if write
+ if (writeFiles) // so if write
{
std::stringstream newTracer;
newTracer << "Tracer" << rank << "_" << tStep << ".vtk";
@@ -414,7 +418,7 @@ ErrorCode compute_tracer_case1(Interface * mb, Intx2MeshOnSphere & worker, Entit
rval = worker.intersect_meshes(covering_set, euler_set, out_set);
CHECK_ERR(rval);
- if (!noWrite) // so if write
+ if (writeFiles) // so if write
{
std::stringstream intx_mesh;
intx_mesh << "Intx" << rank << "_" << tStep << ".vtk";
@@ -440,7 +444,7 @@ ErrorCode compute_tracer_case1(Interface * mb, Intx2MeshOnSphere & worker, Entit
rval = mb->write_file(resTrace.str().c_str(), 0, "PARALLEL=WRITE_PART", &euler_set, 1, &tagElem, 1);
}
- if (!noWrite) // so if write
+ if (writeFiles) // so if write
{
std::stringstream newIntx;
newIntx << "newIntx" << rank << "_" << tStep << ".vtk";
@@ -484,68 +488,49 @@ int main(int argc, char **argv)
{
MPI_Init(&argc, &argv);
+ LONG_DESC << "This program simulates a transport problem on a sphere"
+ " according to a benchmark from a Nair & Lauritzen paper.\n"
+ << "It starts with a partitioned mesh on a sphere, add a tracer, and steps through.\n" <<
+ "The flow reverses after half time, and it should return to original configuration, if the integration was exact. ";
+ ProgOptions opts(LONG_DESC.str(), BRIEF_DESC);
- std::string extra_read_opts;
// read a homme file, partitioned in 16 so far
std::string fileN= TestDir + "/HN16.h5m";
const char *filename_mesh1 = fileN.c_str();
- if (argc > 1)
- {
- int index = 1;
- while (index < argc)
- {
- if (!strcmp(argv[index], "-gtol")) // this is for geometry tolerance
- {
- gtol = atof(argv[++index]);
- }
-
- if (!strcmp(argv[index], "-input"))
- {
- filename_mesh1 = argv[++index];
- }
-
- if (!strcmp(argv[index], "-O"))
- {
- extra_read_opts = std::string(argv[++index]);
- }
-
- if (!strcmp(argv[index], "-f"))
- {
- field_type = atoi(argv[++index]);
- }
- if (!strcmp(argv[index], "-ns"))
- {
- numSteps = atoi(argv[++index]);
- }
-
- if (!strcmp(argv[index], "-nw"))
- {
- noWrite = true;
- }
-
- if (!strcmp(argv[index], "-v"))
- {
- velocity = true;
- }
-
- if (!strcmp(argv[index], "-pw"))
- {
- parallelWrite = true;
- }
-
- if (!strcmp(argv[index], "-h"))
- {
- std::cout << "usage: -gtol <tol> -input <file> -O <extra_read_opts> -v (output velocities) \n "
- << "-f <field_type> -h (this help) -ns <numSteps> -pw (parallel write) -nw (no dbg write) \n";
- std::cout << " field type: 1: quasi-smooth; 2: smooth; 3: slotted cylinders (non-smooth)\n";
- return 0;
- }
- index++;
- }
- }
+
+ opts.addOpt<double>("gtolerance,g",
+ "geometric absolute tolerance (used for point concidence on the sphere)", >ol);
+
+ std::string input_file;
+ opts.addOpt<std::string>("input_file,i", "input mesh file, partitioned",
+ &input_file);
+ std::string extra_read_opts;
+ opts.addOpt<std::string>("extra_read_options,O", "extra read options ",
+ &extra_read_opts);
+ //int field_type;
+ opts.addOpt<int>("field_type,f",
+ "field type-- 1: quasi-smooth; 2: smooth; 3: slotted cylinders (non-smooth)", &field_type);
+
+ opts.addOpt<int>("num_steps,n",
+ "number of steps ", &numSteps);
+
+ //bool reorder = false;
+ opts.addOpt<void>("write_debug_files,w", "write debugging files during simulation ",
+ &writeFiles);
+
+ opts.addOpt<void>("write_velocity_files,v", "Reorder mesh to group entities by partition",
+ &velocity);
+
+ opts.addOpt<void>("write_result_in_parallel,p", "write tracer result files",
+ ¶llelWrite);
+
+ opts.parseCommandLine(argc, argv);
+
+ if (!input_file.empty())
+ filename_mesh1=input_file.c_str();
// read in parallel, in the "euler_set", the initial mesh
- std::string opts = std::string("PARALLEL=READ_PART;PARTITION=PARALLEL_PARTITION")+
+ std::string optsRead = std::string("PARALLEL=READ_PART;PARTITION=PARALLEL_PARTITION")+
std::string(";PARALLEL_RESOLVE_SHARED_ENTS")+extra_read_opts;
Core moab;
Interface & mb = moab;
@@ -554,7 +539,7 @@ int main(int argc, char **argv)
rval = mb.create_meshset(MESHSET_SET, euler_set);
CHECK_ERR(rval);
- rval = mb.load_file(filename_mesh1, &euler_set, opts.c_str());
+ rval = mb.load_file(filename_mesh1, &euler_set, optsRead.c_str());
ParallelComm* pcomm = ParallelComm::get_pcomm(&mb, 0);
CHECK_ERR(rval);
@@ -569,7 +554,7 @@ int main(int argc, char **argv)
std::cout << " case 1: use -gtol " << gtol <<
" -R " << radius << " -input " << filename_mesh1 << " -f " << field_type <<
" numSteps: " << numSteps << "\n";
- std::cout<<" write debug results: " << (noWrite ? "no" : "yes") << "\n";
+ std::cout<<" write debug results: " << (writeFiles ? "yes" : "no") << "\n";
std::cout<< " write tracer in parallel: " << ( parallelWrite ? "yes" : "no") << "\n";
std::cout <<" output velocity: " << (velocity? "yes" : "no") << "\n";
}
https://bitbucket.org/fathomteam/moab/commits/ce159c7e5cb7/
Changeset: ce159c7e5cb7
Branch: None
User: iulian07
Date: 2013-11-13 06:57:34
Summary: report area of the intersection polygons;
Affected #: 1 file
diff --git a/tools/mbcslam/Intx2MeshOnSphere.cpp b/tools/mbcslam/Intx2MeshOnSphere.cpp
index 7ea5854..a1d786b 100644
--- a/tools/mbcslam/Intx2MeshOnSphere.cpp
+++ b/tools/mbcslam/Intx2MeshOnSphere.cpp
@@ -452,6 +452,7 @@ ErrorCode Intx2MeshOnSphere::update_tracer_data(EntityHandle out_set, Tag & tagE
std::vector<double> newValues(rs2.size(), 0.);// initialize with 0 all of them
// area of the polygon * conc on red (old) current quantity
// finaly, divide by the area of the red
+ double check_intx_area=0.;
for (Range::iterator it= polys.begin(); it!=polys.end(); it++)
{
EntityHandle poly=*it;
@@ -465,6 +466,7 @@ ErrorCode Intx2MeshOnSphere::update_tracer_data(EntityHandle out_set, Tag & tagE
// big assumption here, red and blue are "parallel" ;we should have an index from
// blue to red (so a deformed blue corresponds to an arrival red)
double areap = area_spherical_element(mb, poly, R);
+ check_intx_area+=areap;
// so the departure cell at time t (blueIndex) covers a portion of a redCell
// that quantity will be transported to the redCell at time t+dt
// the blue corresponds to a red arrival
@@ -535,10 +537,17 @@ ErrorCode Intx2MeshOnSphere::update_tracer_data(EntityHandle out_set, Tag & tagE
ERRORR(rval, "can't set new values tag");
double total_mass=0.;
+ double total_intx_area =0;
int mpi_err = MPI_Reduce(&total_mass_local, &total_mass, 1, MPI_DOUBLE, MPI_SUM, 0, MPI_COMM_WORLD);
if (MPI_SUCCESS != mpi_err) return MB_FAILURE;
+ // now reduce total area
+ mpi_err = MPI_Reduce(&check_intx_area, &total_intx_area, 1, MPI_DOUBLE, MPI_SUM, 0, MPI_COMM_WORLD);
+ if (MPI_SUCCESS != mpi_err) return MB_FAILURE;
if (my_rank==0)
+ {
std::cout <<"total mass now:" << total_mass << "\n";
+ std::cout <<"check: total intersection area: (4 * M_PI * R^2): " << total_intx_area << "\n";
+ }
if (remote_cells)
{
https://bitbucket.org/fathomteam/moab/commits/9f8346f39e8a/
Changeset: 9f8346f39e8a
Branch: None
User: iulian07
Date: 2013-11-13 06:57:34
Summary: side number for padded polygons
the only problem is the edge between last node and first node;
Affected #: 1 file
diff --git a/src/Core.cpp b/src/Core.cpp
index ad6bdda..a6e6cfd 100644
--- a/src/Core.cpp
+++ b/src/Core.cpp
@@ -2971,7 +2971,7 @@ ErrorCode Core::side_number(const EntityHandle parent,
return (0 == temp_result ? MB_SUCCESS : MB_FAILURE);
}
else if (TYPE_FROM_HANDLE(parent) == MBPOLYGON) {
- // find location of 1st vertex
+ // find location of 1st vertex; this works even for padded vertices
const EntityHandle *first_v = std::find(parent_conn, parent_conn+num_parent_vertices,
child_conn[0]);
if (first_v == parent_conn+num_parent_vertices) return MB_ENTITY_NOT_FOUND;
@@ -2990,11 +2990,23 @@ ErrorCode Core::side_number(const EntityHandle parent,
else return MB_ENTITY_NOT_FOUND;
}
else if (TYPE_FROM_HANDLE(child) == MBEDGE) {
+ // determine the actual number of vertices, for the padded case
+ // the padded case could be like ABCDEFFF; num_parent_vertices=8, actual_num_parent_vertices=6
+ int actual_num_parent_vertices = num_parent_vertices;
+ while(actual_num_parent_vertices>=3 &&
+ (parent_conn[actual_num_parent_vertices-2] ==parent_conn[actual_num_parent_vertices-1] ) )
+ actual_num_parent_vertices--;
+
if (parent_conn[(sd_number+1)%num_parent_vertices] == child_conn[1])
sense = 1;
else if (parent_conn[(sd_number+num_parent_vertices-1)%num_parent_vertices] ==
- child_conn[1])
+ child_conn[1]) // this will also cover edge AF for padded case, side will be 0, sense -1
sense = -1;
+ // if edge FA in above example, we should return sd_number = 5, sense 1
+ else if ((sd_number==actual_num_parent_vertices-1) && (child_conn[1]==parent_conn[0]))
+ sense =1;
+ else
+ return MB_ENTITY_NOT_FOUND;
return MB_SUCCESS;
}
}
https://bitbucket.org/fathomteam/moab/commits/1bbc73aca065/
Changeset: 1bbc73aca065
Branch: master
User: iulian07
Date: 2013-11-13 06:57:34
Summary: use zoltan partitioning for intx_mpas
assumes that the build is configured with zoltan
it is launched in serial as a test here, so it should not matter for
make check
Affected #: 1 file
diff --git a/tools/mbcslam/intx_mpas.cpp b/tools/mbcslam/intx_mpas.cpp
index 6888cb3..570c97f 100644
--- a/tools/mbcslam/intx_mpas.cpp
+++ b/tools/mbcslam/intx_mpas.cpp
@@ -121,7 +121,7 @@ int main(int argc, char **argv)
MPI_Init(&argc, &argv);
std::string extra_read_opts;
- std::string fileN= TestDir + "/mpas_p8.h5m";
+ std::string fileN= TestDir + "/io/mpasx1.642.t.2.nc";
const char *filename_mesh1 = fileN.c_str();
bool flux_form = false;
if (argc > 1)
@@ -164,8 +164,8 @@ int main(int argc, char **argv)
}
}
// start copy
- std::string opts = std::string("PARALLEL=READ_PART;PARTITION=PARALLEL_PARTITION")+
- std::string(";PARALLEL_RESOLVE_SHARED_ENTS")+extra_read_opts;
+ std::string opts = std::string("PARALLEL=READ_PART;PARTITION_METHOD=RCBZOLTAN")+
+ std::string(";PARALLEL_RESOLVE_SHARED_ENTS;VARIABLE=;")+extra_read_opts;
Core moab;
Interface & mb = moab;
EntityHandle euler_set;
Repository URL: https://bitbucket.org/fathomteam/moab/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the moab-dev
mailing list