From: michael Date: Thu, 17 Dec 2020 09:57:18 +0000 (+0100) Subject: Extended script to work with 3D meshes X-Git-Tag: V9_7_0~85 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=7dd6e2c98c2ad3712835e93805a8642fa8c2c587;p=tools%2Fsolverlab.git Extended script to work with 3D meshes --- diff --git a/CoreFlows/examples/C/WaveSystem_2DFV_SphericalExplosion_CDMATH.cxx b/CoreFlows/examples/C/WaveSystem_2DFV_SphericalExplosion_CDMATH.cxx index 24ad784..3fe8baa 100755 --- a/CoreFlows/examples/C/WaveSystem_2DFV_SphericalExplosion_CDMATH.cxx +++ b/CoreFlows/examples/C/WaveSystem_2DFV_SphericalExplosion_CDMATH.cxx @@ -1,7 +1,7 @@ //============================================================================ // Author : Michael NDJINGA // Date : November 2020 -// Description : 2D linear wave system +// Description : multiD linear wave system //============================================================================ #include @@ -27,18 +27,39 @@ void initial_conditions_shock(Mesh my_mesh,Field& pressure_field,Field& velocity double rayon=0.35; double xcentre=0.; double ycentre=0; - + double zcentre=0; + + double x, y, z; + double val, valX, valY, valZ; + int dim =my_mesh.getMeshDimension(); int nbCells=my_mesh.getNumberOfCells(); for (int j=0 ; j1) + { + y = my_mesh.getCell(j).y() ; + if(dim==3) + z = my_mesh.getCell(j).z() ; + } + valX=(x-xcentre)*(x-xcentre); + if(dim==1) + val=sqrt(valX); + else if(dim==2) + { + valY=(y-ycentre)*(y-ycentre); + val=sqrt(valX+valY); + } + else if(dim==3) + { + valY=(y-ycentre)*(y-ycentre); + valZ=(z-zcentre)*(z-zcentre); + val=sqrt(valX+valY+valZ); + } + for(int idim=0; idim=2) Un[k + 2*nbCells] = rho0*velocity_field[k,1] ; - if(dim==3) - Un[k + 3*nbCells] = rho0*velocity_field[k,2]; - } + if(dim==3) + Un[k + 3*nbCells] = rho0*velocity_field[k,2]; + } /* * MED output of the initial condition at t=0 and iter = 0 @@ -230,9 +251,9 @@ void WaveSystem2D(double tmax, int ntmax, double cfl, int output_freq, const Mes int main(int argc, char *argv[]) { - cout << "-- Starting the RESOLUTION OF THE 2D WAVE SYSTEM"< @@ -28,18 +29,39 @@ void initial_conditions_shock(Mesh my_mesh,Field& pressure_field,Field& velocity double rayon=0.35; double xcentre=0.; double ycentre=0; - + double zcentre=0; + + double x, y, z; + double val, valX, valY, valZ; + int dim =my_mesh.getMeshDimension(); int nbCells=my_mesh.getNumberOfCells(); for (int j=0 ; j1) + { + y = my_mesh.getCell(j).y() ; + if(dim==3) + z = my_mesh.getCell(j).z() ; + } + valX=(x-xcentre)*(x-xcentre); + if(dim==1) + val=sqrt(valX); + else if(dim==2) + { + valY=(y-ycentre)*(y-ycentre); + val=sqrt(valX+valY); + } + else if(dim==3) + { + valY=(y-ycentre)*(y-ycentre); + valZ=(z-zcentre)*(z-zcentre); + val=sqrt(valX+valY+valZ); + } + for(int idim=0; idim2) resultDirectory = argv[2]; } - WaveSystem2D(tmax,ntmax,cfl,freqSortie,myMesh,fileOutPut, rank, size, resultDirectory); + + WaveSystem(tmax,ntmax,cfl,freqSortie,myMesh,fileOutPut, rank, size, resultDirectory); if(rank == 0) cout << "Simulation complete." << endl;