Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pugs
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
code
pugs
Commits
41124c36
Commit
41124c36
authored
3 months ago
by
t. chantrait
Browse files
Options
Downloads
Patches
Plain Diff
Fix symmetric BC
parent
eb0e8e7f
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/language/modules/SchemeModule.cpp
+36
-11
36 additions, 11 deletions
src/language/modules/SchemeModule.cpp
src/scheme/SerrailleSolver.cpp
+55
-10
55 additions, 10 deletions
src/scheme/SerrailleSolver.cpp
src/scheme/SerrailleSolver.hpp
+3
-1
3 additions, 1 deletion
src/scheme/SerrailleSolver.hpp
with
94 additions
and
22 deletions
src/language/modules/SchemeModule.cpp
+
36
−
11
View file @
41124c36
...
@@ -1531,6 +1531,31 @@ SchemeModule::SchemeModule()
...
@@ -1531,6 +1531,31 @@ SchemeModule::SchemeModule()
));
));
this
->
_addBuiltinFunction
(
"apply_hyperplastic_fluxes_cauchygreen_serraille"
,
std
::
function
(
[](
const
std
::
shared_ptr
<
const
DiscreteFunctionVariant
>&
rho
,
const
std
::
shared_ptr
<
const
DiscreteFunctionVariant
>&
u
,
const
std
::
shared_ptr
<
const
DiscreteFunctionVariant
>&
E
,
const
std
::
shared_ptr
<
const
DiscreteFunctionVariant
>&
Fe
,
const
std
::
shared_ptr
<
const
DiscreteFunctionVariant
>&
zeta
,
const
std
::
shared_ptr
<
const
DiscreteFunctionVariant
>&
yield
,
const
std
::
shared_ptr
<
const
DiscreteFunctionVariant
>&
sigma
,
const
std
::
shared_ptr
<
const
ItemValueVariant
>&
ur
,
const
std
::
shared_ptr
<
const
SubItemValuePerItemVariant
>&
Fjr
,
const
std
::
vector
<
std
::
shared_ptr
<
const
IBoundaryConditionDescriptor
>>&
bc_descriptor_list
,
const
double
&
dt
)
->
std
::
tuple
<
std
::
shared_ptr
<
const
MeshVariant
>
,
std
::
shared_ptr
<
const
DiscreteFunctionVariant
>
,
std
::
shared_ptr
<
const
DiscreteFunctionVariant
>
,
std
::
shared_ptr
<
const
DiscreteFunctionVariant
>
,
std
::
shared_ptr
<
const
DiscreteFunctionVariant
>>
{
return
HyperplasticSolverSerrailleHandler
{
getCommonMesh
({
rho
,
u
,
E
,
Fe
})}
.
solver
()
.
apply_fluxes
(
dt
,
rho
,
u
,
E
,
Fe
,
zeta
,
yield
,
sigma
,
ur
,
Fjr
,
bc_descriptor_list
,
HyperplasticSolverSerrailleHandler
::
RelaxationType
::
CauchyGreen
);
}));
this
->
_addBuiltinFunction
(
"hyperplastic_glace_solver_serraille"
,
this
->
_addBuiltinFunction
(
"hyperplastic_glace_solver_serraille"
,
std
::
function
(
std
::
function
(
...
...
This diff is collapsed.
Click to expand it.
src/scheme/SerrailleSolver.cpp
+
55
−
10
View file @
41124c36
...
@@ -434,6 +434,29 @@ class HyperplasticSolverSerrailleHandler::SerrailleSolver final
...
@@ -434,6 +434,29 @@ class HyperplasticSolverSerrailleHandler::SerrailleSolver final
this
->
_applySymmetryBC
(
bc_list
,
Ar
,
br
);
this
->
_applySymmetryBC
(
bc_list
,
Ar
,
br
);
this
->
_applyVelocityBC
(
bc_list
,
Ar
,
br
);
this
->
_applyVelocityBC
(
bc_list
,
Ar
,
br
);
}
}
void
_projectOnBoundary
(
const
BoundaryConditionList
&
bc_list
,
NodeValue
<
Rd
>&
xr
)
const
{
for
(
const
auto
&
boundary_condition
:
bc_list
)
{
std
::
visit
(
[
&
](
auto
&&
bc
)
{
using
T
=
std
::
decay_t
<
decltype
(
bc
)
>
;
if
constexpr
(
std
::
is_same_v
<
SymmetryBoundaryCondition
,
T
>
)
{
const
Rd
&
n
=
bc
.
outgoingNormal
();
const
Rd
&
o
=
bc
.
origin
();
const
Array
<
const
NodeId
>&
node_list
=
bc
.
nodeList
();
parallel_for
(
bc
.
numberOfNodes
(),
PUGS_LAMBDA
(
int
r_number
)
{
const
NodeId
r
=
node_list
[
r_number
];
Rd
&
x
=
xr
[
node_list
[
r
]];
x
-=
dot
(
x
-
o
,
n
)
*
n
;
});
}
},
boundary_condition
);
}
}
NodeValue
<
const
Rd
>
NodeValue
<
const
Rd
>
_computeUr
(
const
MeshType
&
mesh
,
const
NodeValue
<
Rdxd
>&
Ar
,
const
NodeValue
<
Rd
>&
br
)
const
_computeUr
(
const
MeshType
&
mesh
,
const
NodeValue
<
Rdxd
>&
Ar
,
const
NodeValue
<
Rd
>&
br
)
const
...
@@ -536,7 +559,9 @@ class HyperplasticSolverSerrailleHandler::SerrailleSolver final
...
@@ -536,7 +559,9 @@ class HyperplasticSolverSerrailleHandler::SerrailleSolver final
const
DiscreteScalarFunction
&
yield
,
const
DiscreteScalarFunction
&
yield
,
const
DiscreteTensorFunction3d
&
sigma
,
const
DiscreteTensorFunction3d
&
sigma
,
const
NodeValue
<
const
Rd
>&
ur
,
const
NodeValue
<
const
Rd
>&
ur
,
const
NodeValuePerCell
<
const
Rd
>&
Fjr
)
const
const
NodeValuePerCell
<
const
Rd
>&
Fjr
,
const
std
::
vector
<
std
::
shared_ptr
<
const
IBoundaryConditionDescriptor
>>&
bc_descriptor_list
)
const
{
{
const
auto
&
cell_to_node_matrix
=
mesh
.
connectivity
().
cellToNodeMatrix
();
const
auto
&
cell_to_node_matrix
=
mesh
.
connectivity
().
cellToNodeMatrix
();
...
@@ -623,7 +648,9 @@ class HyperplasticSolverSerrailleHandler::SerrailleSolver final
...
@@ -623,7 +648,9 @@ class HyperplasticSolverSerrailleHandler::SerrailleSolver final
const
DiscreteScalarFunction
&
yield
,
const
DiscreteScalarFunction
&
yield
,
const
DiscreteTensorFunction3d
&
sigma
,
const
DiscreteTensorFunction3d
&
sigma
,
const
NodeValue
<
const
Rd
>&
ur
,
const
NodeValue
<
const
Rd
>&
ur
,
const
NodeValuePerCell
<
const
Rd
>&
Fjr
)
const
const
NodeValuePerCell
<
const
Rd
>&
Fjr
,
const
std
::
vector
<
std
::
shared_ptr
<
const
IBoundaryConditionDescriptor
>>&
bc_descriptor_list
)
const
{
{
const
auto
&
cell_to_node_matrix
=
mesh
.
connectivity
().
cellToNodeMatrix
();
const
auto
&
cell_to_node_matrix
=
mesh
.
connectivity
().
cellToNodeMatrix
();
...
@@ -711,7 +738,9 @@ class HyperplasticSolverSerrailleHandler::SerrailleSolver final
...
@@ -711,7 +738,9 @@ class HyperplasticSolverSerrailleHandler::SerrailleSolver final
const
DiscreteScalarFunction
&
yield
,
const
DiscreteScalarFunction
&
yield
,
const
DiscreteTensorFunction3d
&
sigma
,
const
DiscreteTensorFunction3d
&
sigma
,
const
NodeValue
<
const
Rd
>&
ur
,
const
NodeValue
<
const
Rd
>&
ur
,
const
NodeValuePerCell
<
const
Rd
>&
Fjr
)
const
const
NodeValuePerCell
<
const
Rd
>&
Fjr
,
const
std
::
vector
<
std
::
shared_ptr
<
const
IBoundaryConditionDescriptor
>>&
bc_descriptor_list
)
const
{
{
const
auto
&
cell_to_node_matrix
=
mesh
.
connectivity
().
cellToNodeMatrix
();
const
auto
&
cell_to_node_matrix
=
mesh
.
connectivity
().
cellToNodeMatrix
();
...
@@ -723,6 +752,9 @@ class HyperplasticSolverSerrailleHandler::SerrailleSolver final
...
@@ -723,6 +752,9 @@ class HyperplasticSolverSerrailleHandler::SerrailleSolver final
NodeValue
<
Rd
>
new_xr
=
copy
(
mesh
.
xr
());
NodeValue
<
Rd
>
new_xr
=
copy
(
mesh
.
xr
());
parallel_for
(
mesh
.
numberOfNodes
(),
PUGS_LAMBDA
(
NodeId
r
)
{
new_xr
[
r
]
+=
dt
*
ur
[
r
];
});
parallel_for
(
mesh
.
numberOfNodes
(),
PUGS_LAMBDA
(
NodeId
r
)
{
new_xr
[
r
]
+=
dt
*
ur
[
r
];
});
const
BoundaryConditionList
bc_list
=
this
->
_getBCList
(
mesh
,
bc_descriptor_list
);
this
->
_projectOnBoundary
(
bc_list
,
new_xr
);
std
::
shared_ptr
<
const
MeshType
>
new_mesh
=
std
::
make_shared
<
MeshType
>
(
mesh
.
shared_connectivity
(),
new_xr
);
std
::
shared_ptr
<
const
MeshType
>
new_mesh
=
std
::
make_shared
<
MeshType
>
(
mesh
.
shared_connectivity
(),
new_xr
);
CellValue
<
const
double
>
Vj
=
MeshDataManager
::
instance
().
getMeshData
(
mesh
).
Vj
();
CellValue
<
const
double
>
Vj
=
MeshDataManager
::
instance
().
getMeshData
(
mesh
).
Vj
();
...
@@ -778,7 +810,6 @@ class HyperplasticSolverSerrailleHandler::SerrailleSolver final
...
@@ -778,7 +810,6 @@ class HyperplasticSolverSerrailleHandler::SerrailleSolver final
// const R3x3 expMT = EigenvalueSolver{}.computeExpForTinyMatrix(transpose(M));
// const R3x3 expMT = EigenvalueSolver{}.computeExpForTinyMatrix(transpose(M));
// calcul de S trial
// calcul de S trial
const
R3x3
Strial
=
(
new_mu
[
j
]
/
J
)
*
(
Be_barre
-
1.
/
3
*
trace
(
Be_barre
)
*
I
);
const
R3x3
Strial
=
(
new_mu
[
j
]
/
J
)
*
(
Be_barre
-
1.
/
3
*
trace
(
Be_barre
)
*
I
);
double
limit2
=
2.
/
3
*
yield
[
j
]
*
yield
[
j
];
double
limit2
=
2.
/
3
*
yield
[
j
]
*
yield
[
j
];
double
normS2
=
frobeniusNorm
(
Strial
);
double
normS2
=
frobeniusNorm
(
Strial
);
...
@@ -800,7 +831,6 @@ class HyperplasticSolverSerrailleHandler::SerrailleSolver final
...
@@ -800,7 +831,6 @@ class HyperplasticSolverSerrailleHandler::SerrailleSolver final
// const double fenorm1 = frobeniusNorm(new_Be[j]);
// const double fenorm1 = frobeniusNorm(new_Be[j]);
// rationorm[j] = fenorm1 / fenorm0;
// rationorm[j] = fenorm1 / fenorm0;
});
});
std
::
cout
<<
"sum_chi "
<<
sum
(
chi
)
<<
"
\n
"
;
CellValue
<
const
double
>
new_Vj
=
MeshDataManager
::
instance
().
getMeshData
(
*
new_mesh
).
Vj
();
CellValue
<
const
double
>
new_Vj
=
MeshDataManager
::
instance
().
getMeshData
(
*
new_mesh
).
Vj
();
...
@@ -828,7 +858,9 @@ class HyperplasticSolverSerrailleHandler::SerrailleSolver final
...
@@ -828,7 +858,9 @@ class HyperplasticSolverSerrailleHandler::SerrailleSolver final
const
std
::
shared_ptr
<
const
DiscreteFunctionVariant
>&
sigma
,
const
std
::
shared_ptr
<
const
DiscreteFunctionVariant
>&
sigma
,
const
std
::
shared_ptr
<
const
ItemValueVariant
>&
ur
,
const
std
::
shared_ptr
<
const
ItemValueVariant
>&
ur
,
const
std
::
shared_ptr
<
const
SubItemValuePerItemVariant
>&
Fjr
,
const
std
::
shared_ptr
<
const
SubItemValuePerItemVariant
>&
Fjr
,
const
RelaxationType
&
relaxation_type
)
const
const
std
::
vector
<
std
::
shared_ptr
<
const
IBoundaryConditionDescriptor
>>&
bc_descriptor_list
,
const
RelaxationType
&
relaxation_type
)
const
{
{
std
::
shared_ptr
mesh_v
=
getCommonMesh
({
rho
,
u
,
E
});
std
::
shared_ptr
mesh_v
=
getCommonMesh
({
rho
,
u
,
E
});
if
(
not
mesh_v
)
{
if
(
not
mesh_v
)
{
...
@@ -850,7 +882,9 @@ class HyperplasticSolverSerrailleHandler::SerrailleSolver final
...
@@ -850,7 +882,9 @@ class HyperplasticSolverSerrailleHandler::SerrailleSolver final
yield
->
get
<
DiscreteScalarFunction
>
(),
//
yield
->
get
<
DiscreteScalarFunction
>
(),
//
sigma
->
get
<
DiscreteTensorFunction3d
>
(),
//
sigma
->
get
<
DiscreteTensorFunction3d
>
(),
//
ur
->
get
<
NodeValue
<
const
Rd
>>
(),
//
ur
->
get
<
NodeValue
<
const
Rd
>>
(),
//
Fjr
->
get
<
NodeValuePerCell
<
const
Rd
>>
());
Fjr
->
get
<
NodeValuePerCell
<
const
Rd
>>
(),
bc_descriptor_list
);
}
}
case
RelaxationType
::
Implicit
:
{
case
RelaxationType
::
Implicit
:
{
return
this
->
apply_fluxes2
(
dt
,
//
return
this
->
apply_fluxes2
(
dt
,
//
...
@@ -863,7 +897,9 @@ class HyperplasticSolverSerrailleHandler::SerrailleSolver final
...
@@ -863,7 +897,9 @@ class HyperplasticSolverSerrailleHandler::SerrailleSolver final
yield
->
get
<
DiscreteScalarFunction
>
(),
//
yield
->
get
<
DiscreteScalarFunction
>
(),
//
sigma
->
get
<
DiscreteTensorFunction3d
>
(),
//
sigma
->
get
<
DiscreteTensorFunction3d
>
(),
//
ur
->
get
<
NodeValue
<
const
Rd
>>
(),
//
ur
->
get
<
NodeValue
<
const
Rd
>>
(),
//
Fjr
->
get
<
NodeValuePerCell
<
const
Rd
>>
());
Fjr
->
get
<
NodeValuePerCell
<
const
Rd
>>
(),
bc_descriptor_list
);
}
}
case
RelaxationType
::
CauchyGreen
:
{
case
RelaxationType
::
CauchyGreen
:
{
return
this
->
apply_fluxes_B
(
dt
,
//
return
this
->
apply_fluxes_B
(
dt
,
//
...
@@ -876,7 +912,10 @@ class HyperplasticSolverSerrailleHandler::SerrailleSolver final
...
@@ -876,7 +912,10 @@ class HyperplasticSolverSerrailleHandler::SerrailleSolver final
yield
->
get
<
DiscreteScalarFunction
>
(),
//
yield
->
get
<
DiscreteScalarFunction
>
(),
//
sigma
->
get
<
DiscreteTensorFunction3d
>
(),
//
sigma
->
get
<
DiscreteTensorFunction3d
>
(),
//
ur
->
get
<
NodeValue
<
const
Rd
>>
(),
//
ur
->
get
<
NodeValue
<
const
Rd
>>
(),
//
Fjr
->
get
<
NodeValuePerCell
<
const
Rd
>>
());
Fjr
->
get
<
NodeValuePerCell
<
const
Rd
>>
(),
bc_descriptor_list
);
}
}
default
:
{
default
:
{
throw
UnexpectedError
(
"invalid relaxation type"
);
throw
UnexpectedError
(
"invalid relaxation type"
);
...
@@ -1088,7 +1127,7 @@ class HyperplasticSolverSerrailleHandler::SerrailleSolver final
...
@@ -1088,7 +1127,7 @@ class HyperplasticSolverSerrailleHandler::SerrailleSolver final
const
std
::
vector
<
std
::
shared_ptr
<
const
IBoundaryConditionDescriptor
>>&
bc_descriptor_list
)
const
const
std
::
vector
<
std
::
shared_ptr
<
const
IBoundaryConditionDescriptor
>>&
bc_descriptor_list
)
const
{
{
auto
[
ur
,
Fjr
]
=
compute_fluxes
(
solver_type
,
rho
,
aL
,
aT
,
u
,
sigma
,
bc_descriptor_list
);
auto
[
ur
,
Fjr
]
=
compute_fluxes
(
solver_type
,
rho
,
aL
,
aT
,
u
,
sigma
,
bc_descriptor_list
);
return
apply_fluxes
(
dt
,
rho
,
u
,
E
,
Fe
,
zeta
,
yield
,
sigma
,
ur
,
Fjr
,
relaxation_type
);
return
apply_fluxes
(
dt
,
rho
,
u
,
E
,
Fe
,
zeta
,
yield
,
sigma
,
ur
,
Fjr
,
bc_descriptor_list
,
relaxation_type
);
}
}
std
::
tuple
<
std
::
shared_ptr
<
const
MeshVariant
>
,
std
::
tuple
<
std
::
shared_ptr
<
const
MeshVariant
>
,
...
@@ -1486,6 +1525,12 @@ class HyperplasticSolverSerrailleHandler::SerrailleSolver<MeshType>::SymmetryBou
...
@@ -1486,6 +1525,12 @@ class HyperplasticSolverSerrailleHandler::SerrailleSolver<MeshType>::SymmetryBou
return
m_mesh_flat_node_boundary
.
outgoingNormal
();
return
m_mesh_flat_node_boundary
.
outgoingNormal
();
}
}
const
Rd
&
origin
()
const
{
return
m_mesh_flat_node_boundary
.
origin
();
}
size_t
size_t
numberOfNodes
()
const
numberOfNodes
()
const
{
{
...
...
This diff is collapsed.
Click to expand it.
src/scheme/SerrailleSolver.hpp
+
3
−
1
View file @
41124c36
...
@@ -59,7 +59,9 @@ class HyperplasticSolverSerrailleHandler
...
@@ -59,7 +59,9 @@ class HyperplasticSolverSerrailleHandler
const
std
::
shared_ptr
<
const
DiscreteFunctionVariant
>&
sigma
,
const
std
::
shared_ptr
<
const
DiscreteFunctionVariant
>&
sigma
,
const
std
::
shared_ptr
<
const
ItemValueVariant
>&
ur
,
const
std
::
shared_ptr
<
const
ItemValueVariant
>&
ur
,
const
std
::
shared_ptr
<
const
SubItemValuePerItemVariant
>&
Fjr
,
const
std
::
shared_ptr
<
const
SubItemValuePerItemVariant
>&
Fjr
,
const
RelaxationType
&
relaxation_type
)
const
=
0
;
const
std
::
vector
<
std
::
shared_ptr
<
const
IBoundaryConditionDescriptor
>>&
bc_descriptor_list
,
const
RelaxationType
&
relaxation_type
)
const
=
0
;
virtual
std
::
tuple
<
std
::
shared_ptr
<
const
MeshVariant
>
,
virtual
std
::
tuple
<
std
::
shared_ptr
<
const
MeshVariant
>
,
std
::
shared_ptr
<
const
DiscreteFunctionVariant
>
,
std
::
shared_ptr
<
const
DiscreteFunctionVariant
>
,
...
...
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
sign in
to comment