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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
code
pugs
Commits
fc63eeaa
Commit
fc63eeaa
authored
3 years ago
by
Axelle Drouard
Browse files
Options
Downloads
Patches
Plain Diff
Fix renormalization v
parent
7f0b0ce0
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/scheme/ScalarNodalScheme.cpp
+17
-12
17 additions, 12 deletions
src/scheme/ScalarNodalScheme.cpp
with
17 additions
and
12 deletions
src/scheme/ScalarNodalScheme.cpp
+
17
−
12
View file @
fc63eeaa
...
@@ -143,7 +143,7 @@ class ScalarNodalSchemeHandler::ScalarNodalScheme : public ScalarNodalSchemeHand
...
@@ -143,7 +143,7 @@ class ScalarNodalSchemeHandler::ScalarNodalScheme : public ScalarNodalSchemeHand
}
}
ScalarNodalScheme
(
const
std
::
shared_ptr
<
const
MeshType
>&
mesh
,
ScalarNodalScheme
(
const
std
::
shared_ptr
<
const
MeshType
>&
mesh
,
const
std
::
shared_ptr
<
const
DiscreteFunctionP0
<
Dimension
,
TinyMatrix
<
Dimension
>>>&
cell_k_b
ound
,
const
std
::
shared_ptr
<
const
DiscreteFunctionP0
<
Dimension
,
TinyMatrix
<
Dimension
>>>&
cell_k_b
,
const
std
::
shared_ptr
<
const
DiscreteFunctionP0
<
Dimension
,
TinyMatrix
<
Dimension
>>>&
cell_k
,
const
std
::
shared_ptr
<
const
DiscreteFunctionP0
<
Dimension
,
TinyMatrix
<
Dimension
>>>&
cell_k
,
const
std
::
shared_ptr
<
const
DiscreteFunctionP0
<
Dimension
,
double
>>&
f
,
const
std
::
shared_ptr
<
const
DiscreteFunctionP0
<
Dimension
,
double
>>&
f
,
const
std
::
vector
<
std
::
shared_ptr
<
const
IBoundaryConditionDescriptor
>>&
bc_descriptor_list
)
const
std
::
vector
<
std
::
shared_ptr
<
const
IBoundaryConditionDescriptor
>>&
bc_descriptor_list
)
...
@@ -409,7 +409,7 @@ class ScalarNodalSchemeHandler::ScalarNodalScheme : public ScalarNodalSchemeHand
...
@@ -409,7 +409,7 @@ class ScalarNodalSchemeHandler::ScalarNodalScheme : public ScalarNodalSchemeHand
{
{
CellValue
<
const
TinyMatrix
<
Dimension
>>
cell_kappaj
=
cell_k
->
cellValues
();
CellValue
<
const
TinyMatrix
<
Dimension
>>
cell_kappaj
=
cell_k
->
cellValues
();
CellValue
<
const
TinyMatrix
<
Dimension
>>
cell_kappajb
=
cell_k_b
ound
->
cellValues
();
CellValue
<
const
TinyMatrix
<
Dimension
>>
cell_kappajb
=
cell_k_b
->
cellValues
();
const
NodeValue
<
const
TinyMatrix
<
Dimension
>>
node_kappar
=
[
&
]
{
const
NodeValue
<
const
TinyMatrix
<
Dimension
>>
node_kappar
=
[
&
]
{
NodeValue
<
TinyMatrix
<
Dimension
>>
kappa
{
mesh
->
connectivity
()};
NodeValue
<
TinyMatrix
<
Dimension
>>
kappa
{
mesh
->
connectivity
()};
...
@@ -568,8 +568,12 @@ class ScalarNodalSchemeHandler::ScalarNodalScheme : public ScalarNodalSchemeHand
...
@@ -568,8 +568,12 @@ class ScalarNodalSchemeHandler::ScalarNodalScheme : public ScalarNodalSchemeHand
const
NodeValue
<
const
TinyVector
<
Dimension
>>
v
=
[
&
]
{
const
NodeValue
<
const
TinyVector
<
Dimension
>>
v
=
[
&
]
{
NodeValue
<
TinyVector
<
Dimension
>>
compute_v
{
mesh
->
connectivity
()};
NodeValue
<
TinyVector
<
Dimension
>>
compute_v
{
mesh
->
connectivity
()};
parallel_for
(
parallel_for
(
mesh
->
numberOfNodes
(),
mesh
->
numberOfNodes
(),
PUGS_LAMBDA
(
NodeId
node_id
)
{
PUGS_LAMBDA
(
NodeId
node_id
)
{
compute_v
[
node_id
]
=
node_kapparb
[
node_id
]
*
exterior_normal
[
node_id
];
});
if
(
is_boundary_node
[
node_id
])
{
compute_v
[
node_id
]
=
1.
/
l2Norm
(
node_kapparb
[
node_id
]
*
exterior_normal
[
node_id
])
*
node_kapparb
[
node_id
]
*
exterior_normal
[
node_id
];
}
});
return
compute_v
;
return
compute_v
;
}();
}();
...
@@ -704,7 +708,7 @@ class ScalarNodalSchemeHandler::ScalarNodalScheme : public ScalarNodalSchemeHand
...
@@ -704,7 +708,7 @@ class ScalarNodalSchemeHandler::ScalarNodalScheme : public ScalarNodalSchemeHand
b
[
cell_id
]
+=
node_boundary_values
[
node_id
]
*
b
[
cell_id
]
+=
node_boundary_values
[
node_id
]
*
(
1.
/
(
sum_theta
[
node_id
]
*
l2Norm
(
node_kapparb
[
node_id
]
*
n
))
*
(
1.
/
(
sum_theta
[
node_id
]
*
l2Norm
(
node_kapparb
[
node_id
]
*
n
))
*
dot
(
kapparb_invBetar
[
node_id
]
*
sum_Cjr
[
node_id
],
P
*
Cjr
(
cell_id
,
i_node
))
-
dot
(
kapparb_invBetar
[
node_id
]
*
sum_Cjr
[
node_id
],
P
*
Cjr
(
cell_id
,
i_node
))
+
dot
(
Cjr
(
cell_id
,
i_node
),
n
));
dot
(
Cjr
(
cell_id
,
i_node
),
n
));
}
}
}
else
if
(
node_is_corner
[
node_id
])
{
}
else
if
(
node_is_corner
[
node_id
])
{
...
@@ -727,7 +731,8 @@ class ScalarNodalSchemeHandler::ScalarNodalScheme : public ScalarNodalSchemeHand
...
@@ -727,7 +731,8 @@ class ScalarNodalSchemeHandler::ScalarNodalScheme : public ScalarNodalSchemeHand
const
CellId
cell_id_k
=
node_to_cell
[
i_cell_k
];
const
CellId
cell_id_k
=
node_to_cell
[
i_cell_k
];
const
size_t
i_node_k
=
node_local_number_in_its_cells
[
i_cell_k
];
const
size_t
i_node_k
=
node_local_number_in_its_cells
[
i_cell_k
];
b
[
cell_id_j
]
+=
dot
(
node_boundary_values
[
node_id
]
*
kappar_invBetar
[
node_id
]
*
Cjr
(
cell_id_k
,
i_node_k
),
b
[
cell_id_j
]
+=
dot
(
node_boundary_values
[
node_id
]
*
kapparb_invBetar
[
node_id
]
*
Cjr
(
cell_id_k
,
i_node_k
),
Cjr
(
cell_id_j
,
i_node_j
));
Cjr
(
cell_id_j
,
i_node_j
));
}
}
}
}
...
@@ -742,7 +747,7 @@ class ScalarNodalSchemeHandler::ScalarNodalScheme : public ScalarNodalSchemeHand
...
@@ -742,7 +747,7 @@ class ScalarNodalSchemeHandler::ScalarNodalScheme : public ScalarNodalSchemeHand
const
size_t
i_node_k
=
node_local_number_in_its_cells
[
i_cell_k
];
const
size_t
i_node_k
=
node_local_number_in_its_cells
[
i_cell_k
];
b
[
cell_id_j
]
+=
b
[
cell_id_j
]
+=
dot
(
node_boundary_values
[
node_id
]
*
corner_kappar_invBetar
[
node_id
]
*
Cjr
(
cell_id_k
,
i_node_k
),
dot
(
node_boundary_values
[
node_id
]
*
corner_kappar
b
_invBetar
[
node_id
]
*
Cjr
(
cell_id_k
,
i_node_k
),
Cjr
(
cell_id_j
,
i_node_j
));
Cjr
(
cell_id_j
,
i_node_j
));
}
}
}
}
...
@@ -771,7 +776,7 @@ ScalarNodalSchemeHandler::solution() const
...
@@ -771,7 +776,7 @@ ScalarNodalSchemeHandler::solution() const
}
}
ScalarNodalSchemeHandler
::
ScalarNodalSchemeHandler
(
ScalarNodalSchemeHandler
::
ScalarNodalSchemeHandler
(
const
std
::
shared_ptr
<
const
IDiscreteFunction
>&
cell_k_b
ound
,
const
std
::
shared_ptr
<
const
IDiscreteFunction
>&
cell_k_b
,
const
std
::
shared_ptr
<
const
IDiscreteFunction
>&
cell_k
,
const
std
::
shared_ptr
<
const
IDiscreteFunction
>&
cell_k
,
const
std
::
shared_ptr
<
const
IDiscreteFunction
>&
f
,
const
std
::
shared_ptr
<
const
IDiscreteFunction
>&
f
,
const
std
::
vector
<
std
::
shared_ptr
<
const
IBoundaryConditionDescriptor
>>&
bc_descriptor_list
)
const
std
::
vector
<
std
::
shared_ptr
<
const
IBoundaryConditionDescriptor
>>&
bc_descriptor_list
)
...
@@ -781,7 +786,7 @@ ScalarNodalSchemeHandler::ScalarNodalSchemeHandler(
...
@@ -781,7 +786,7 @@ ScalarNodalSchemeHandler::ScalarNodalSchemeHandler(
throw
NormalError
(
"primal discrete functions are not defined on the same mesh"
);
throw
NormalError
(
"primal discrete functions are not defined on the same mesh"
);
}
}
checkDiscretizationType
({
cell_k_b
ound
,
cell_k
,
f
},
DiscreteFunctionType
::
P0
);
checkDiscretizationType
({
cell_k_b
,
cell_k
,
f
},
DiscreteFunctionType
::
P0
);
switch
(
i_mesh
->
dimension
())
{
switch
(
i_mesh
->
dimension
())
{
case
1
:
{
case
1
:
{
...
@@ -797,7 +802,7 @@ ScalarNodalSchemeHandler::ScalarNodalSchemeHandler(
...
@@ -797,7 +802,7 @@ ScalarNodalSchemeHandler::ScalarNodalSchemeHandler(
m_scheme
=
m_scheme
=
std
::
make_unique
<
ScalarNodalScheme
<
2
>>
(
mesh
,
std
::
make_unique
<
ScalarNodalScheme
<
2
>>
(
mesh
,
std
::
dynamic_pointer_cast
<
const
DiscreteTensorFunctionType
>
(
cell_k_b
ound
),
std
::
dynamic_pointer_cast
<
const
DiscreteTensorFunctionType
>
(
cell_k_b
),
std
::
dynamic_pointer_cast
<
const
DiscreteTensorFunctionType
>
(
cell_k
),
std
::
dynamic_pointer_cast
<
const
DiscreteTensorFunctionType
>
(
cell_k
),
std
::
dynamic_pointer_cast
<
const
DiscreteScalarFunctionType
>
(
f
),
std
::
dynamic_pointer_cast
<
const
DiscreteScalarFunctionType
>
(
f
),
bc_descriptor_list
);
bc_descriptor_list
);
...
@@ -812,7 +817,7 @@ ScalarNodalSchemeHandler::ScalarNodalSchemeHandler(
...
@@ -812,7 +817,7 @@ ScalarNodalSchemeHandler::ScalarNodalSchemeHandler(
m_scheme
=
m_scheme
=
std
::
make_unique
<
ScalarNodalScheme
<
3
>>
(
mesh
,
std
::
make_unique
<
ScalarNodalScheme
<
3
>>
(
mesh
,
std
::
dynamic_pointer_cast
<
const
DiscreteTensorFunctionType
>
(
cell_k_b
ound
),
std
::
dynamic_pointer_cast
<
const
DiscreteTensorFunctionType
>
(
cell_k_b
),
std
::
dynamic_pointer_cast
<
const
DiscreteTensorFunctionType
>
(
cell_k
),
std
::
dynamic_pointer_cast
<
const
DiscreteTensorFunctionType
>
(
cell_k
),
std
::
dynamic_pointer_cast
<
const
DiscreteScalarFunctionType
>
(
f
),
std
::
dynamic_pointer_cast
<
const
DiscreteScalarFunctionType
>
(
f
),
bc_descriptor_list
);
bc_descriptor_list
);
...
...
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