-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Temperature-dependant solid domain constraints #1038
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First review, I will go through it again on Monday or Thuesday.
Very nice addition and nicely done! Great job :)
e2a81d9
to
851baf4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few things there and there. Good job!
import pandas as pd | ||
|
||
import os |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need to add these modules?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are called in the script but they are not imported before.
constrain_solid_domain.declare_parameters( | ||
prm, 1); // at the moment, default value of the number of constraints is | ||
// set to one since we are only applying to one-fluid simulations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default value should always be one right? We can use a similar mechanism to the one we use in the boundary conditions to pre-detect the number of contraints. Otherwise, you could have a max constraints to pregenerate them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly, I was thinking of having a max value variable, but I didn't do it since it was only one. I'll rename the argument just to make it clear.
source/solvers/navier_stokes_base.cc
Outdated
NavierStokesBase<dim, VectorType, DofsType>::flag_dofs_in_solid( | ||
std::unordered_set<types::global_dof_index> &dofs_are_in_solid, | ||
const std::vector<types::global_dof_index> &local_dof_indices) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this function is called within a cell, I would consider inlining it and defining it in Utilities or somewhere else
source/solvers/navier_stokes_base.cc
Outdated
template <int dim, typename VectorType, typename DofsType> | ||
bool | ||
NavierStokesBase<dim, VectorType, DofsType>::check_cell_is_in_solid( | ||
const std::unordered_set<types::global_dof_index> &dofs_are_in_solid, | ||
const std::vector<types::global_dof_index> &local_dof_indices) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this function is called within a cell, I would consider inlining it and defining it in Utilities or somewhere else
source/solvers/navier_stokes_base.cc
Outdated
template <int dim, typename VectorType, typename DofsType> | ||
void | ||
NavierStokesBase<dim, VectorType, DofsType>::flag_dofs_connected_to_fluid( | ||
std::unordered_set<types::global_dof_index> &dofs_are_connected_to_fluid, | ||
const std::vector<types::global_dof_index> &local_dof_indices) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this function is called within a cell, I would consider inlining it and defining it in Utilities or somewhere else
source/solvers/navier_stokes_base.cc
Outdated
|
||
template <int dim, typename VectorType, typename DofsType> | ||
bool | ||
NavierStokesBase<dim, VectorType, DofsType>::check_cell_is_connected_to_fluid( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this function is called within a cell, I would consider inlining it and defining it in Utilities or somewhere else
source/solvers/navier_stokes_base.cc
Outdated
NavierStokesBase<dim, VectorType, DofsType>::constrain_pressure( | ||
const bool &non_zero_constraints, | ||
const std::vector<types::global_dof_index> &local_dof_indices, | ||
AffineConstraints<double> &zero_constraints) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this function is called within a cell, I would consider inlining it and defining it in Utilities or somewhere else
Co-authored-by: hepap <[email protected]>
Co-authored-by: hepap <[email protected]>
Co-authored-by: Olivier Guévremont <[email protected]>
Co-authored-by: Olivier Guévremont <[email protected]> Co-authored-by: hepap <[email protected]>
Co-authored-by: Bruno Blais <[email protected]>
Co-authored-by: Bruno Blais <[email protected]>
Co-authored-by: hepap <[email protected]>
Co-authored-by: hepap <[email protected]>
cd9380f
to
dce627f
Compare
@AmishgaAlphonius can you rebase if the tests don't pass? Then I'll merge after CI |
Description of the problem In phase change simulations, the solid domain was treated as a simple fluid with a higher viscosity (viscous penalization). It worked quite well, but it wasn't the most efficient way to compute fluid dynamics quantities. In order to improve calculation time and linear system conditioning, homogeneous constraints are imposed on velocity DOFs in a defined solid domain through a temperature range. Additionally, pressure DOFs in the same solid domain that are not connected to fluid cells are also imposed to homogeneous constraints. The temperature range is specified through a parameter subsection, namely constrain solid domain. Previously, the implementation was done for single-fluid simulations (Temperature-dependant solid domain constraints #1038), but simulations such as laser powder bed fusion (LPBF) meltpool ones require two fluids when modelling. Description of the solution This PR, implements the new temperature-dependent solid domain constraints for two-phase Volume of Fluid (VOF) simulations. To select cells on which the constraints are applied, we check if the filtered phase fraction at quadrature points in the cell are within a range of accepted values. This range of accepted values is defined with the phase fraction tolerance parameter. This parameter defines an absolute tolerance on filtered phase fraction. How Has This Been Tested? The new feature has been tested on the Melting Cavity example by modelling to parts of the domain with different fluids while keeping the same properties in both fluids. An application test has been added to test this feature : applications_tests/lethe-fluid/heat_transfer_vof_phase_change_constrain_solid_domain.prm (.output) Documentation Documentation page was updated: (doc/source/parameters/cfd/constrain_solid_domain.rst). Comments The structure of constrain_solid_domain() changed a bit. More functions were added to avoid code line repetitions in constrain_solid_domain_vof(). Small corrections were made in other files. Co-authored-by: hepap <[email protected]> Co-authored-by: Bruno Blais <[email protected]> Co-authored-by: Olivier Guévremont <[email protected]>
Description This PR adds a small section in the melting cavity example featuring the new constrain stasis feature from (Temperature-dependant solid domain constraints #1038). Documentation Parameter documentation was also updated : doc/source/parameters/cfd/constrain_stasis.rst
Description of the problem In phase change simulations, the solid domain was treated as a simple fluid with a higher viscosity (viscous penalization). It worked quite well, but it wasn't the most efficient way to compute fluid dynamics quantities. Description of the solution In order to improve calculation time and linear system conditioning, homogeneous constraints are imposed on velocity DOFs in a defined solid domain through a temperature range. Additionally, pressure DOFs in the same solid domain that are not connected to fluid cells are also imposed to homogeneous constraints. The temperature range is specified through a new parameter subsection, namely constrain solid domain. How Has This Been Tested? The new feature has been tested on the Melting Cavity example. With solid domain constraints on cells within the temperature range of [0,29] degC, the linear solver solving time of the fluid dynamics physic was reduced by a little more than the half without altering the postprocessed results. This feature will improve greatly computation times of domains with a higher proportion of "solid" phase. The feature was also tested with the restart feature and no issue occurred. Final results were the same as without the restart. An application test has been add to test this feature : applications_tests/lethe-fluid/heat_transfer_phase_change_constrain_solid_domain.prm (.output) Documentation A new page for the new parameter subsection (constrain solid domain) has been added : doc/source/parameters/cfd/constrain_solid_domain.rst Future changes The current implementation of this new feature only works with 1 fluid simulations (an exception is thrown when used with VOF or Cahn Hilliard). However, the implementation with VOF simulations will be added in a near future. Comments The use of a dynamic_zero_constraints AffineConstraints object, rather than reconstruction of the zero_constraints one at every time step was determined to be optimal after some profiling tests. A small mistake found in establish_solid_domain() was corrected. Parameters are stored in vectors for the upcoming implementation of the feature in multiple fluid simulations. The Variable enum class was moved from parameters.h to multiphysics.h. Using variables from the Variable enum class, the constrained and constraining fields could be parametrized in the future according to user needs. Other minor corrections were also made to the documentation. Missing module imports for the Melting Cavity example postprocessing were added. Please disregard name of the branch, it depicts a slight change of plans. Co-authored-by: hepap <[email protected]> Co-authored-by: Olivier Guévremont <[email protected]> Co-authored-by: Bruno Blais <[email protected]> Former-commit-id: 332dabe
…-polymtl#1048) Description of the problem In phase change simulations, the solid domain was treated as a simple fluid with a higher viscosity (viscous penalization). It worked quite well, but it wasn't the most efficient way to compute fluid dynamics quantities. In order to improve calculation time and linear system conditioning, homogeneous constraints are imposed on velocity DOFs in a defined solid domain through a temperature range. Additionally, pressure DOFs in the same solid domain that are not connected to fluid cells are also imposed to homogeneous constraints. The temperature range is specified through a parameter subsection, namely constrain solid domain. Previously, the implementation was done for single-fluid simulations (Temperature-dependant solid domain constraints chaos-polymtl#1038), but simulations such as laser powder bed fusion (LPBF) meltpool ones require two fluids when modelling. Description of the solution This PR, implements the new temperature-dependent solid domain constraints for two-phase Volume of Fluid (VOF) simulations. To select cells on which the constraints are applied, we check if the filtered phase fraction at quadrature points in the cell are within a range of accepted values. This range of accepted values is defined with the phase fraction tolerance parameter. This parameter defines an absolute tolerance on filtered phase fraction. How Has This Been Tested? The new feature has been tested on the Melting Cavity example by modelling to parts of the domain with different fluids while keeping the same properties in both fluids. An application test has been added to test this feature : applications_tests/lethe-fluid/heat_transfer_vof_phase_change_constrain_solid_domain.prm (.output) Documentation Documentation page was updated: (doc/source/parameters/cfd/constrain_solid_domain.rst). Comments The structure of constrain_solid_domain() changed a bit. More functions were added to avoid code line repetitions in constrain_solid_domain_vof(). Small corrections were made in other files. Co-authored-by: hepap <[email protected]> Co-authored-by: Bruno Blais <[email protected]> Co-authored-by: Olivier Guévremont <[email protected]> Former-commit-id: 581ad84
Description This PR adds a small section in the melting cavity example featuring the new constrain stasis feature from (Temperature-dependant solid domain constraints chaos-polymtl#1038). Documentation Parameter documentation was also updated : doc/source/parameters/cfd/constrain_stasis.rst Former-commit-id: e843eae
Description of the problem In phase change simulations, the solid domain was treated as a simple fluid with a higher viscosity (viscous penalization). It worked quite well, but it wasn't the most efficient way to compute fluid dynamics quantities. Description of the solution In order to improve calculation time and linear system conditioning, homogeneous constraints are imposed on velocity DOFs in a defined solid domain through a temperature range. Additionally, pressure DOFs in the same solid domain that are not connected to fluid cells are also imposed to homogeneous constraints. The temperature range is specified through a new parameter subsection, namely constrain solid domain. How Has This Been Tested? The new feature has been tested on the Melting Cavity example. With solid domain constraints on cells within the temperature range of [0,29] degC, the linear solver solving time of the fluid dynamics physic was reduced by a little more than the half without altering the postprocessed results. This feature will improve greatly computation times of domains with a higher proportion of "solid" phase. The feature was also tested with the restart feature and no issue occurred. Final results were the same as without the restart. An application test has been add to test this feature : applications_tests/lethe-fluid/heat_transfer_phase_change_constrain_solid_domain.prm (.output) Documentation A new page for the new parameter subsection (constrain solid domain) has been added : doc/source/parameters/cfd/constrain_solid_domain.rst Future changes The current implementation of this new feature only works with 1 fluid simulations (an exception is thrown when used with VOF or Cahn Hilliard). However, the implementation with VOF simulations will be added in a near future. Comments The use of a dynamic_zero_constraints AffineConstraints object, rather than reconstruction of the zero_constraints one at every time step was determined to be optimal after some profiling tests. A small mistake found in establish_solid_domain() was corrected. Parameters are stored in vectors for the upcoming implementation of the feature in multiple fluid simulations. The Variable enum class was moved from parameters.h to multiphysics.h. Using variables from the Variable enum class, the constrained and constraining fields could be parametrized in the future according to user needs. Other minor corrections were also made to the documentation. Missing module imports for the Melting Cavity example postprocessing were added. Please disregard name of the branch, it depicts a slight change of plans. Co-authored-by: hepap <[email protected]> Co-authored-by: Olivier Guévremont <[email protected]> Co-authored-by: Bruno Blais <[email protected]> Former-commit-id: 332dabe
Description of the problem In phase change simulations, the solid domain was treated as a simple fluid with a higher viscosity (viscous penalization). It worked quite well, but it wasn't the most efficient way to compute fluid dynamics quantities. In order to improve calculation time and linear system conditioning, homogeneous constraints are imposed on velocity DOFs in a defined solid domain through a temperature range. Additionally, pressure DOFs in the same solid domain that are not connected to fluid cells are also imposed to homogeneous constraints. The temperature range is specified through a parameter subsection, namely constrain solid domain. Previously, the implementation was done for single-fluid simulations (Temperature-dependant solid domain constraints #1038), but simulations such as laser powder bed fusion (LPBF) meltpool ones require two fluids when modelling. Description of the solution This PR, implements the new temperature-dependent solid domain constraints for two-phase Volume of Fluid (VOF) simulations. To select cells on which the constraints are applied, we check if the filtered phase fraction at quadrature points in the cell are within a range of accepted values. This range of accepted values is defined with the phase fraction tolerance parameter. This parameter defines an absolute tolerance on filtered phase fraction. How Has This Been Tested? The new feature has been tested on the Melting Cavity example by modelling to parts of the domain with different fluids while keeping the same properties in both fluids. An application test has been added to test this feature : applications_tests/lethe-fluid/heat_transfer_vof_phase_change_constrain_solid_domain.prm (.output) Documentation Documentation page was updated: (doc/source/parameters/cfd/constrain_solid_domain.rst). Comments The structure of constrain_solid_domain() changed a bit. More functions were added to avoid code line repetitions in constrain_solid_domain_vof(). Small corrections were made in other files. Co-authored-by: hepap <[email protected]> Co-authored-by: Bruno Blais <[email protected]> Co-authored-by: Olivier Guévremont <[email protected]> Former-commit-id: 581ad84
Description This PR adds a small section in the melting cavity example featuring the new constrain stasis feature from (Temperature-dependant solid domain constraints #1038). Documentation Parameter documentation was also updated : doc/source/parameters/cfd/constrain_stasis.rst Former-commit-id: e843eae
Description of the problem
Description of the solution
constrain solid domain
.How Has This Been Tested?
restart
feature and no issue occurred. Final results were the same as without the restart.applications_tests/lethe-fluid/heat_transfer_phase_change_constrain_solid_domain.prm
(.output
)Documentation
constrain solid domain
) has been added :doc/source/parameters/cfd/constrain_solid_domain.rst
Future changes
Comments
dynamic_zero_constraints
AffineConstraints object, rather than reconstruction of thezero_constraints
one at every time step was determined to be optimal after some profiling tests.establish_solid_domain()
was corrected.Variable
enum class was moved fromparameters.h
tomultiphysics.h
. Using variables from theVariable
enum class, the constrained and constraining fields could be parametrized in the future according to user needs.