Skip to content
Snippets Groups Projects
Commit d4a23e7e authored by Éric Béchet's avatar Éric Béchet
Browse files

modified mainElasticity

parent e546b03d
No related branches found
No related tags found
No related merge requests found
...@@ -4,4 +4,4 @@ EdgeDisplacement 8 0 0 ...@@ -4,4 +4,4 @@ EdgeDisplacement 8 0 0
EdgeDisplacement 8 1 0 EdgeDisplacement 8 1 0
EdgeDisplacement 8 2 0 EdgeDisplacement 8 2 0
LineForce 9 100e6 0 0 LineForce 9 100e6 0 0
VolumeForce 7 0 -100.e-3 0 FaceForce 7 0 -1.0e10 0
...@@ -4,4 +4,4 @@ FaceDisplacement 8 0 0 ...@@ -4,4 +4,4 @@ FaceDisplacement 8 0 0
FaceDisplacement 8 1 0 FaceDisplacement 8 1 0
FaceDisplacement 8 2 0 FaceDisplacement 8 2 0
FaceForce 9 100e6 0 0 FaceForce 9 100e6 0 0
VolumeForce 7 0 -100.e-3 0 VolumeForce 7 0 -1.0e10 0
...@@ -167,14 +167,14 @@ public: ...@@ -167,14 +167,14 @@ public:
*/ */
/*
template<class T> class Field : public Function<T> // renvoie des valeurs de champ (ff*valeurs dofs), gradient , etc... template<class T> class Field : public Function<T> // renvoie des valeurs de champ (ff*valeurs dofs), gradient , etc...
{ {
public: public:
Field(){}; Field(){};
virtual ~Field(){}; virtual ~Field(){};
}; };
*/
class FormBilinearBase class FormBilinearBase
......
...@@ -16,14 +16,28 @@ int main (int argc, char* argv[]) ...@@ -16,14 +16,28 @@ int main (int argc, char* argv[])
GmshInitialize(argc, argv); GmshInitialize(argc, argv);
// globals are still present in Gmsh // globals are still present in Gmsh
// instanciate a solver // instanciate a solver
elasticitySolver mySolver (1000); MyelasticitySolver mySolver (1000);
//elasticitySolver mySolver (1000);
// read some input file // read some input file
mySolver.readInputFile(argv[1]); mySolver.readInputFile(argv[1]);
// solve the problem
mySolver.solve();
PView *pv = mySolver.buildDisplacementView("displacement");
pv->getData()->writeMSH("disp.msh", false);
delete pv;
// stop gmsh
GmshFinalize();
}
/*
groupOfElements *g = new groupOfElements (2, 7); groupOfElements *g = new groupOfElements (2, 7);
MElement *e=*(g->begin()); MElement *e=*(g->begin());
...@@ -31,21 +45,46 @@ int main (int argc, char* argv[]) ...@@ -31,21 +45,46 @@ int main (int argc, char* argv[])
const double uvw[3]={0.,0.,0.}; const double uvw[3]={0.,0.,0.};
std::vector<Dof> dofs; std::vector<Dof> dofs;
std::vector<double> vals; std::vector<double> vals;
std::vector<SVector3> grads;
std::vector<SVector3> vals2;
std::vector<STensor3> grads2;
std::ostream_iterator< double > output( std::cout, " " ); std::ostream_iterator< double > output( std::cout, " " );
ScalarLagrangeFunctionSpace L(100); ScalarLagrangeFunctionSpace L(100);
std::cout << L.getNumKeys(e) << "fonctions de formes L" << std::endl; std::cout << L.getNumKeys(e) << "fonctions de formes L" << std::endl;
L.getKeys(e,dofs);
for (int i=0;i<dofs.size();++i) std::cout << "entity: " << dofs[i].getEntity() << " id: " << dofs[i].getType() << std::endl;
dofs.clear();
L.f(e,0.1,0.1,0,vals); L.f(e,0.1,0.1,0,vals);
std::copy(vals.begin(),vals.end(),output); L.gradf(e,0.1,0.1,0,grads);
std::copy(vals.begin(),vals.end(),output); std::cout << std::endl;
for (std::vector<SVector3>::iterator it=grads.begin();it!=grads.end();++it) { std::cout << (*it)[0]<< " " << (*it)[1] <<" " << (*it)[2] << std::endl; }
VectorLagrangeFunctionSpace L1(101,VectorLagrangeFunctionSpace::VECTOR_X); VectorLagrangeFunctionSpace L1(100,VectorLagrangeFunctionSpace::VECTOR_X);
std::cout << L1.getNumKeys(e) << "fonctions de formes L1" << std::endl; VectorLagrangeFunctionSpace L2(100,VectorLagrangeFunctionSpace::VECTOR_Y);
VectorLagrangeFunctionSpace L2(102,VectorLagrangeFunctionSpace::VECTOR_Y); std::cout << L2.getNumKeys(e) << "fonctions de formes L2" << std::endl;
VectorLagrangeFunctionSpace L3(103,VectorLagrangeFunctionSpace::VECTOR_Z); L2.f(e,0.1,0.1,0,vals2);
L2.gradf(e,0.1,0.1,0,grads2);
for (std::vector<SVector3>::iterator it=vals2.begin();it!=vals2.end();++it) { std::cout << (*it)[0]<< " " << (*it)[1] <<" " << (*it)[2] << std::endl; }
for (std::vector<STensor3>::iterator it=grads2.begin();it!=grads2.end();++it) { (*it).print(""); }
VectorLagrangeFunctionSpace L3(100,VectorLagrangeFunctionSpace::VECTOR_Z);
ProductFunctionSpace<VectorLagrangeFunctionSpace::ValType> P123(L1,L2,L3); VectorLagrangeFunctionSpace P123(100);
std::cout << P123.getNumKeys(e) << "fonctions de formes P123" << std::endl; std::cout << P123.getNumKeys(e) << "fonctions de formes P123" << std::endl;
P123.getKeys(e,dofs); P123.getKeys(e,dofs);
std::cout << dofs.size() << std::endl; std::cout << dofs.size() << std::endl;
for (int i=0;i<dofs.size();++i) std::cout << "entity: " << dofs[i].getEntity() << " id: " << dofs[i].getType() << std::endl;
vals2.clear();
grads2.clear();
P123.f(e,0.1,0.1,0,vals2);
P123.gradf(e,0.1,0.1,0,grads2);
for (std::vector<SVector3>::iterator it=vals2.begin();it!=vals2.end();++it) { std::cout << (*it)[0]<< " " << (*it)[1] <<" " << (*it)[2] << std::endl; }
for (std::vector<STensor3>::iterator it=grads2.begin();it!=grads2.end();++it) { (*it).print(""); }
FormBilinear<TermBilinearMeca,ScalarLagrangeFunctionSpace,ScalarLagrangeFunctionSpace > f(L,L); FormBilinear<TermBilinearMeca,ScalarLagrangeFunctionSpace,ScalarLagrangeFunctionSpace > f(L,L);
f.func(); f.func();
...@@ -55,19 +94,9 @@ int main (int argc, char* argv[]) ...@@ -55,19 +94,9 @@ int main (int argc, char* argv[])
FormBilinear<TermBilinearMecaNL,ScalarLagrangeFunctionSpace,ScalarLagrangeFunctionSpace > fnl(L,L); FormBilinear<TermBilinearMecaNL,ScalarLagrangeFunctionSpace,ScalarLagrangeFunctionSpace > fnl(L,L);
fnl.func(); fnl.func();
*/
// solve the problem
mySolver.solve();
PView *pv = mySolver.buildDisplacementView("displacement");
pv->getData()->writeMSH("disp.msh", false);
delete pv;
// stop gmsh
GmshFinalize();
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment