15 #ifndef KRATOS_ESTIMATE_DT_UTILITIES_H
16 #define KRATOS_ESTIMATE_DT_UTILITIES_H
80 mViscousFourier = 0.0;
81 mThermalFourier = 0.0;
82 mConsiderArtificialDiffusion =
false;
83 mConsiderCompressibilityInCFL =
false;
85 SetDtEstimationMagnitudesFlag();
101 const double ViscousFourier,
102 const double ThermalFourier,
103 const bool ConsiderArtificialDiffusion,
104 const bool NodalDensityFormulation,
107 const bool ConsiderCompressibilityInCFL =
false)
113 mViscousFourier = ViscousFourier;
114 mThermalFourier = ThermalFourier;
115 mConsiderArtificialDiffusion = ConsiderArtificialDiffusion;
116 mNodalDensityFormulation = NodalDensityFormulation;
117 mConsiderCompressibilityInCFL = ConsiderCompressibilityInCFL;
119 SetDtEstimationMagnitudesFlag();
133 "automatic_time_step" : true,
135 "Viscous_Fourier_number" : 0.0,
136 "Thermal_Fourier_number" : 0.0,
137 "consider_artificial_diffusion" : false,
138 "nodal_density_formulation" : false,
139 "minimum_delta_time" : 1e-4,
140 "maximum_delta_time" : 0.1,
141 "consider_compressibility_in_CFL" : false
146 mCFL = rParameters["CFL_number"].
GetDouble();
147 mViscousFourier = rParameters[
"Viscous_Fourier_number"].
GetDouble();
148 mThermalFourier = rParameters[
"Thermal_Fourier_number"].
GetDouble();
149 mConsiderArtificialDiffusion = rParameters[
"consider_artificial_diffusion"].
GetBool();
150 mNodalDensityFormulation = rParameters[
"nodal_density_formulation"].
GetBool();
151 mDtMin = rParameters[
"minimum_delta_time"].
GetDouble();
152 mDtMax = rParameters[
"maximum_delta_time"].
GetDouble();
153 mConsiderCompressibilityInCFL = rParameters[
"consider_compressibility_in_CFL"].
GetBool();
155 SetDtEstimationMagnitudesFlag();
171 void SetCFL(
const double CFL);
178 void SetViscousFourier(
const double ViscousFourier);
185 void SetThermalFourier(
const double ThermalFourier);
192 void SetDtMin(
const double DtMin);
199 void SetDtMax(
const double DtMax);
207 double EstimateDt()
const;
226 double mViscousFourier;
227 double mThermalFourier;
228 bool mConsiderArtificialDiffusion;
229 bool mNodalDensityFormulation;
232 bool mConsiderCompressibilityInCFL;
233 Flags mDtEstimationMagnitudesFlags;
245 void SetDtEstimationMagnitudesFlag();
247 template<const
bool Cons
iderCFL, const
bool Cons
iderViscousFourier, const
bool Cons
iderThermalFourier>
248 double InternalEstimateDt()
const;
261 template <
class... CharacteristicNumbersPairsType>
262 double CalculateNewDeltaTime(
263 const double CurrentDeltaTime,
264 const CharacteristicNumbersPairsType&... rCharacteristicNumbersPairs)
const
269 const double zero_tol =
std::min(0.1 * mDtMin, 1
e-10);
270 double new_dt_list[
sizeof...(CharacteristicNumbersPairsType)] = {(
271 (std::get<0>(rCharacteristicNumbersPairs) > zero_tol) ? CurrentDeltaTime * std::get<1>(rCharacteristicNumbersPairs) / std::get<0>(rCharacteristicNumbersPairs) : mDtMin
275 double new_dt = *(std::min_element(new_dt_list, new_dt_list +
sizeof...(CharacteristicNumbersPairsType)));
276 LimitNewDeltaTime(new_dt);
279 new_dt = mrModelPart.GetCommunicator().GetDataCommunicator().MinAll(new_dt);
292 void LimitNewDeltaTime(
double& rNewDeltaTime)
const;
301 const CFLCalculatorType GetCFLCalculatorUtility()
const;
Base class for all Elements.
Definition: element.h:60
Estimate the time step in a fluid problem to obtain a given Courant number.
Definition: estimate_dt_utilities.h:44
std::function< double(const Geometry< Node > &)> ElementSizeFunctionType
Function type for the element size calculator function.
Definition: estimate_dt_utilities.h:54
EstimateDtUtility(ModelPart &ModelPart, const double CFL, const double DtMin, const double DtMax)
Constructor for CFD-based time step estimation.
Definition: estimate_dt_utilities.h:70
KRATOS_CLASS_POINTER_DEFINITION(EstimateDtUtility)
Pointer definition of EstimateDtUtility.
std::function< double(const Element &, const ElementSizeFunctionType &, const double)> CFLCalculatorType
Definition: estimate_dt_utilities.h:57
EstimateDtUtility(ModelPart &ModelPart, const double CFL, const double ViscousFourier, const double ThermalFourier, const bool ConsiderArtificialDiffusion, const bool NodalDensityFormulation, const double DtMin, const double DtMax, const bool ConsiderCompressibilityInCFL=false)
Complete constructor.
Definition: estimate_dt_utilities.h:98
~EstimateDtUtility()
Destructor.
Definition: estimate_dt_utilities.h:159
EstimateDtUtility(ModelPart &ModelPart, Parameters &rParameters)
Constructor with Kratos parameters.
Definition: estimate_dt_utilities.h:127
Geometry base class.
Definition: geometry.h:71
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
This class provides to Kratos a data structure for I/O based on the standard of JSON.
Definition: kratos_parameters.h:59
double GetDouble() const
This method returns the double contained in the current Parameter.
Definition: kratos_parameters.cpp:657
void ValidateAndAssignDefaults(const Parameters &rDefaultParameters)
This function is designed to verify that the parameters under testing match the form prescribed by th...
Definition: kratos_parameters.cpp:1306
bool GetBool() const
This method returns the boolean contained in the current Parameter.
Definition: kratos_parameters.cpp:675
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_DEFINE_LOCAL_FLAG(name)
Definition: define.h:673
#define KRATOS_TRY
Definition: define.h:109
static double min(double a, double b)
Definition: GeometryFunctions.h:71
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
TABLE_NUMBER_ANGULAR_VELOCITY TABLE_NUMBER_MOMENT I33 BEAM_INERTIA_ROT_UNIT_LENGHT_Y KRATOS_DEFINE_APPLICATION_VARIABLE(DEM_APPLICATION, double, BEAM_INERTIA_ROT_UNIT_LENGHT_Z) typedef std double
Definition: DEM_application_variables.h:182
CFL
Definition: isotropic_damage_automatic_differentiation.py:156
e
Definition: run_cpp_mpi_tests.py:31