10 #ifdef MOAB_HAVE_ZOLTAN
28 #include "TestUtil.hpp"
38 double rot = M_PI / 10;
56 std::string tag_name(
"DP" );
61 rval =
mb->
tag_iterate( tagh, connecVerts.
begin(), connecVerts.
end(), count, data );CHECK_ERR( rval );
63 assert( count == (
int)connecVerts.
size() );
64 double* ptr_DP = (
double*)data;
76 rval =
mb->
get_coords( &oldV, 1, &( posi[0] ) );CHECK_ERR( rval );
79 double lat1 = sphCoord.
lat - 2 * M_PI *
t /
T;
80 double uu = 3 *
radius /
T * pow( sin( lat1 ), 2 ) * sin( 2 * sphCoord.
lon ) * cos( M_PI *
t /
T );
81 uu += 2 *
radius * M_PI * cos( sphCoord.
lon ) /
T;
82 double vv = 3 *
radius /
T * ( sin( 2 * lat1 ) ) * cos( sphCoord.
lon ) * cos( M_PI *
t /
T );
83 double vx = -uu * sin( sphCoord.
lon ) - vv * sin( sphCoord.
lat ) * cos( sphCoord.
lon );
84 double vy = -uu * cos( sphCoord.
lon ) - vv * sin( sphCoord.
lat ) * sin( sphCoord.
lon );
85 double vz = vv * cos( sphCoord.
lat );
87 double x2 = posi[0] * cos( rot ) - posi[1] * sin( rot );
88 double y2 = posi[0] * sin( rot ) + posi[1] * cos( rot );
90 double len1 = newPos.length();
91 newPos =
radius * newPos / len1;
93 ptr_DP[0] = newPos[0];
94 ptr_DP[1] = newPos[1];
95 ptr_DP[2] = newPos[2];
101 int main(
int argc,
char** argv )
104 MPI_Init( &argc, &argv );
106 std::string extra_read_opts;
107 std::string fileN = TestDir +
"unittest/io/mpasx1.642.t.2.nc";
108 const char* filename_mesh1 = fileN.c_str();
109 bool flux_form =
false;
113 while( index < argc )
115 if( !strcmp( argv[index],
"-gtol" ) )
117 gtol = atof( argv[++index] );
119 if( !strcmp( argv[index],
"-dt" ) )
121 delta_t = atof( argv[++index] );
123 if( !strcmp( argv[index],
"-input" ) )
125 filename_mesh1 = argv[++index];
127 if( !strcmp( argv[index],
"-R" ) )
129 radius = atof( argv[++index] );
131 if( !strcmp( argv[index],
"-O" ) )
133 extra_read_opts = std::string( argv[++index] );
135 if( !strcmp( argv[index],
"-FF" ) )
139 if( !strcmp( argv[index],
"-v" ) )
143 if( !strcmp( argv[index],
"-t" ) )
145 t = atof( argv[++index] );
147 if( !strcmp( argv[index],
"-t" ) )
149 t = atof( argv[++index] );
151 if( !strcmp( argv[index],
"-rot" ) )
153 rot = atof( argv[++index] );
161 std::string opts = std::string(
"PARALLEL=READ_PART;PARTITION_METHOD=RCBZOLTAN" ) +
162 std::string(
";PARALLEL_RESOLVE_SHARED_ENTS;VARIABLE=;NO_EDGES;" ) + extra_read_opts;
169 clock_t tt = clock();
171 rval =
mb.
load_file( filename_mesh1, &euler_set, opts.c_str() );CHECK_ERR( rval );
181 std::cout <<
" case 1: use -gtol " <<
gtol <<
" -dt " <<
delta_t <<
" -R " <<
radius <<
" -input "
182 << filename_mesh1 <<
" -t " <<
t <<
" -rot " << rot <<
"\n";
186 std::cout <<
"load mesh from " << filename_mesh1 <<
"\n on " << procs <<
" processors in "
187 << ( clock() - tt ) / (
double)CLOCKS_PER_SEC <<
" seconds" << std::endl;
205 worker.set_radius_source_mesh(
radius );
206 worker.set_radius_destination_mesh(
radius );
207 worker.set_parallel_comm( pcomm );
210 std::cout <<
"manufacture departure mesh " << filename_mesh1 <<
"\n on " << procs <<
" processors in "
211 << ( clock() - tt ) / (
double)CLOCKS_PER_SEC <<
" seconds" << std::endl;
214 rval = worker.FindMaxEdges( euler_set, euler_set );CHECK_ERR( rval );
215 worker.set_error_tolerance(
gtol );
217 rval = worker.create_departure_mesh_2nd_alg( euler_set, covering_lagr_set );CHECK_ERR( rval );
221 std::cout <<
"communicate covering mesh on " << procs <<
" processors in "
222 << ( clock() - tt ) / (
double)CLOCKS_PER_SEC <<
" seconds" << std::endl;
228 std::stringstream lagrIni;
229 lagrIni <<
"lagr0" << rank <<
".h5m";
230 rval =
mb.
write_file( lagrIni.str().c_str(), 0, 0, &covering_lagr_set, 1 );
236 std::stringstream ste;
237 ste <<
"euler0" << rank <<
".h5m";
238 rval =
mb.
write_file( ste.str().c_str(), 0, 0, &euler_set, 1 );
241 if(
MB_SUCCESS != rval ) std::cout <<
"can't write lagr set\n";
245 rval = worker.intersect_meshes( covering_lagr_set, euler_set, outputSet );CHECK_ERR( rval );
249 std::cout <<
"intersect meshes in " << procs <<
" processors in " << ( clock() - tt ) / (
double)CLOCKS_PER_SEC
250 <<
" seconds" << std::endl;
253 if( Verbose && rank <= 4 )
255 std::string opts_write(
"" );
256 std::stringstream outf;
257 outf <<
"intersect0" << rank <<
".h5m";
258 rval =
mb.
write_file( outf.str().c_str(), 0, 0, &outputSet, 1 );
259 if(
MB_SUCCESS != rval ) std::cout <<
"can't write output\n";
267 std::cout <<
"On proc " << rank <<
" arrival area: " << arrival_area <<
" intersection area:" << intx_area
268 <<
" rel error: " << fabs( ( intx_area - arrival_area ) / arrival_area ) <<
"\n";