Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gmsh
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Larry Price
gmsh
Commits
75d6a829
Commit
75d6a829
authored
14 years ago
by
Boris Sedji
Browse files
Options
Downloads
Patches
Plain Diff
No commit message
No commit message
parent
829af106
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Solver/elasticitySolver.cpp
+34
-23
34 additions, 23 deletions
Solver/elasticitySolver.cpp
Solver/elasticitySolver.h
+9
-4
9 additions, 4 deletions
Solver/elasticitySolver.h
with
43 additions
and
27 deletions
Solver/elasticitySolver.cpp
+
34
−
23
View file @
75d6a829
...
...
@@ -249,10 +249,12 @@ void elasticitySolver::readInputFile(const std::string &fn)
/********************* end deprecated api ****************************************/
void
elasticitySolver
::
addDirichletBC
(
int
dim
,
int
entityId
,
int
component
,
double
value
)
{
#if defined (HAVE_LUA)
void
elasticitySolver
::
addDirichletBCLua
(
int
dim
,
int
entityId
,
int
component
,
std
::
string
luaFunctionName
,
lua_State
*
L
)
{
dirichletBC
diri
;
diri
.
g
=
new
groupOfElements
(
dim
,
entityId
);
diri
.
_f
=
new
simpleFunction
<
double
>
(
value
);
diri
.
_f
=
new
simpleFunction
Lua
<
double
>
(
L
,
luaFunctionName
,
0.
);
diri
.
_comp
=
component
;
diri
.
_tag
=
entityId
;
switch
(
dim
)
{
...
...
@@ -264,10 +266,26 @@ void elasticitySolver::addDirichletBC (int dim, int entityId, int component, dou
allDirichlet
.
push_back
(
diri
);
}
void
elasticitySolver
::
addDirichletBCLua
(
int
dim
,
int
entityId
,
int
component
,
std
::
string
luaFunctionName
,
lua_State
*
L
)
{
void
elasticitySolver
::
addNeumannBCLua
(
int
dim
,
int
entityId
,
std
::
string
luaFunctionName
,
lua_State
*
L
)
{
neumannBC
neu
;
neu
.
g
=
new
groupOfElements
(
dim
,
entityId
);
neu
.
_f
=
new
simpleFunctionLua
<
SVector3
>
(
L
,
luaFunctionName
,
SVector3
(
0
,
0
,
0
));
neu
.
_tag
=
entityId
;
switch
(
dim
)
{
case
0
:
neu
.
onWhat
=
BoundaryCondition
::
ON_VERTEX
;
break
;
case
1
:
neu
.
onWhat
=
BoundaryCondition
::
ON_EDGE
;
break
;
case
2
:
neu
.
onWhat
=
BoundaryCondition
::
ON_FACE
;
break
;
default
:
return
;
}
allNeumann
.
push_back
(
neu
);
}
#endif
void
elasticitySolver
::
addDirichletBC
(
int
dim
,
int
entityId
,
int
component
,
double
value
)
{
dirichletBC
diri
;
diri
.
g
=
new
groupOfElements
(
dim
,
entityId
);
diri
.
_f
=
new
simpleFunction
Lua
<
double
>
(
L
,
luaFunctionName
,
0.
);
diri
.
_f
=
new
simpleFunction
<
double
>
(
value
);
diri
.
_comp
=
component
;
diri
.
_tag
=
entityId
;
switch
(
dim
)
{
...
...
@@ -279,6 +297,7 @@ void elasticitySolver::addDirichletBCLua (int dim, int entityId, int component,
allDirichlet
.
push_back
(
diri
);
}
void
elasticitySolver
::
addNeumannBC
(
int
dim
,
int
entityId
,
const
std
::
vector
<
double
>
value
)
{
if
(
value
.
size
()
!=
3
)
return
;
neumannBC
neu
;
...
...
@@ -294,19 +313,7 @@ void elasticitySolver::addNeumannBC (int dim, int entityId, const std::vector<do
allNeumann
.
push_back
(
neu
);
}
void
elasticitySolver
::
addNeumannBCLua
(
int
dim
,
int
entityId
,
std
::
string
luaFunctionName
,
lua_State
*
L
)
{
neumannBC
neu
;
neu
.
g
=
new
groupOfElements
(
dim
,
entityId
);
neu
.
_f
=
new
simpleFunctionLua
<
SVector3
>
(
L
,
luaFunctionName
,
SVector3
(
0
,
0
,
0
));
neu
.
_tag
=
entityId
;
switch
(
dim
)
{
case
0
:
neu
.
onWhat
=
BoundaryCondition
::
ON_VERTEX
;
break
;
case
1
:
neu
.
onWhat
=
BoundaryCondition
::
ON_EDGE
;
break
;
case
2
:
neu
.
onWhat
=
BoundaryCondition
::
ON_FACE
;
break
;
default
:
return
;
}
allNeumann
.
push_back
(
neu
);
}
void
elasticitySolver
::
addElasticDomain
(
int
physical
,
double
e
,
double
nu
){
elasticField
field
;
...
...
@@ -357,7 +364,7 @@ void elasticitySolver::assemble(linearSystem<double> *lsys)
// Voids
for
(
unsigned
int
i
=
0
;
i
<
elasticFields
.
size
();
++
i
)
{
if
(
elasticFields
[
i
].
_E
==
0.
)
if
(
elasticFields
[
i
].
_E
==
0.
)
FixVoidNodalDofs
(
*
LagSpace
,
elasticFields
[
i
].
g
->
begin
(),
elasticFields
[
i
].
g
->
end
(),
*
pAssembler
);
}
// Neumann conditions
...
...
@@ -383,7 +390,7 @@ void elasticitySolver::assemble(linearSystem<double> *lsys)
LoadTerm
<
double
>
Lterm
(
*
LagrangeMultiplierSpace
,
LagrangeMultiplierFields
[
i
].
_f
);
Assemble
(
Lterm
,
*
LagrangeMultiplierSpace
,
LagrangeMultiplierFields
[
i
].
g
->
begin
(),
LagrangeMultiplierFields
[
i
].
g
->
end
(),
Integ_Boundary
,
*
pAssembler
);
}
// Assemble elastic term for
// Assemble elastic term for
GaussQuadrature
Integ_Bulk
(
GaussQuadrature
::
GradGrad
);
for
(
unsigned
int
i
=
0
;
i
<
elasticFields
.
size
();
i
++
)
{
...
...
@@ -464,8 +471,8 @@ PView* elasticitySolver::buildDisplacementView (const std::string postFileName)
vCut
[
e
->
getVertex
(
j
)]
=
e
->
getParent
();
}
}
else
{
for
(
int
j
=
0
;
j
<
e
->
getNumVertices
();
++
j
)
else
{
for
(
int
j
=
0
;
j
<
e
->
getNumVertices
();
++
j
)
v
.
insert
(
e
->
getVertex
(
j
));
}
}
...
...
@@ -602,8 +609,11 @@ PView* elasticitySolver::buildVonMisesView(const std::string &postFileName)
}
#endif
#if defined (HAVE_LUA)
#include
"Bindings.h"
void
elasticitySolverRegisterBindings
(
binding
*
b
)
void
elasticitySolverRegisterBindings
(
binding
*
b
)
{
classBinding
*
cb
;
cb
=
b
->
addClass
<
elasticitySolver
>
(
"elasticitySolver"
);
...
...
@@ -645,7 +655,7 @@ void elasticitySolverRegisterBindings(binding *b)
cm
->
setArgNames
(
"fileName"
,
NULL
);
cm
=
cb
->
addMethod
(
"buildDisplacementView"
,
&
elasticitySolver
::
buildDisplacementView
);
cm
->
setDescription
(
"create a new view."
);
cm
->
setDescription
(
"create a new view."
);
cm
->
setArgNames
(
"fileName"
,
NULL
);
cm
=
cb
->
addMethod
(
"buildLagrangeMultiplierView"
,
&
elasticitySolver
::
buildLagrangeMultiplierView
);
...
...
@@ -663,3 +673,4 @@ void elasticitySolverRegisterBindings(binding *b)
cm
->
setArgNames
(
"model"
,
"tag"
,
NULL
);
}
#endif
This diff is collapsed.
Click to expand it.
Solver/elasticitySolver.h
+
9
−
4
View file @
75d6a829
...
...
@@ -55,7 +55,6 @@ struct neumannBC : public BoundaryCondition
simpleFunction
<
SVector3
>
*
_f
;
neumannBC
()
:
BoundaryCondition
(),
_f
(
NULL
){}
};
// an elastic solver ...
class
elasticitySolver
{
...
...
@@ -73,17 +72,23 @@ class elasticitySolver
std
::
vector
<
neumannBC
>
allNeumann
;
// dirichlet BC
std
::
vector
<
dirichletBC
>
allDirichlet
;
public:
elasticitySolver
(
int
tag
)
:
_tag
(
tag
),
LagSpace
(
0
),
pAssembler
(
0
),
LagrangeMultiplierSpace
(
0
)
{}
elasticitySolver
(
GModel
*
model
,
int
tag
);
void
addDirichletBC
(
int
dim
,
int
entityId
,
int
component
,
double
value
);
void
addDirichletBCLua
(
int
dim
,
int
entityId
,
int
component
,
std
::
string
luaFunctionName
,
lua_State
*
L
);
void
addNeumannBC
(
int
dim
,
int
entityId
,
const
std
::
vector
<
double
>
value
);
void
addNeumannBCLua
(
int
dim
,
int
entityId
,
std
::
string
luaFunctionName
,
lua_State
*
L
);
void
addElasticDomain
(
int
tag
,
double
e
,
double
nu
);
#if defined (HAVE_LUA)
void
addDirichletBCLua
(
int
dim
,
int
entityId
,
int
component
,
std
::
string
luaFunctionName
,
lua_State
*
L
);
void
addNeumannBCLua
(
int
dim
,
int
entityId
,
std
::
string
luaFunctionName
,
lua_State
*
L
);
#endif
virtual
~
elasticitySolver
()
{
if
(
LagSpace
)
delete
LagSpace
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment