Skip to content
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

[GeoMechanicsApplication] Add micro climate condition #11890

Merged
merged 129 commits into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from 118 commits
Commits
Show all changes
129 commits
Select commit Hold shift + click to select a range
908c0bb
Added Mohamed's micro-climate condition "as-is"
avdg81 Nov 30, 2023
04ba84a
Made `CalculateLocalSystem` a `public` member
avdg81 Nov 30, 2023
6c2f4cc
Made `Initialize` and `InitializeSolutionStep` `public` members
avdg81 Nov 30, 2023
40a701a
Added a first unit test for `InitializeSolutionStep`
avdg81 Dec 1, 2023
d26e80a
Registered micro-climate condition in the GeoMechanicsApplication
avdg81 Dec 1, 2023
e4858bf
Let the model part create the micro-climate condition
avdg81 Dec 1, 2023
87b76fe
Refactored the unit test for `InitializeSolutionStep`
avdg81 Dec 1, 2023
23ecf62
Added a unit test for 3-noded (line) micro-climate conditions
avdg81 Dec 4, 2023
cc91081
Added a unit test for 4-noded (line) micro-climate conditions
avdg81 Dec 4, 2023
06e3c08
Added a unit test for 5-noded (line) micro-climate conditions
avdg81 Dec 4, 2023
6757543
Generalized the way nodes are created for a micro-climate condition
avdg81 Dec 4, 2023
29c50f9
Creating a condition for testing now requires the dimension size
avdg81 Dec 4, 2023
c90e443
Added a test for a condition acting on a quadratic triangle
avdg81 Dec 4, 2023
b3f0f47
Added a test for a condition acting on a linear quadrilateral
avdg81 Dec 4, 2023
f15440c
Added a test for a condition acting on a serendipity element
avdg81 Dec 4, 2023
ec35856
Added a test for a condition acting on a LaGrange element
avdg81 Dec 4, 2023
1604345
Added two unit tests for calculating the local system
avdg81 Dec 4, 2023
9d00606
Modified the unit test that verifies the LHS matrix calculation
avdg81 Dec 7, 2023
6a594b1
Modified the unit test that verifies the RHS vector calculation
avdg81 Dec 7, 2023
0dbefc3
Added a test to verify the local system of a triangular condition
avdg81 Dec 7, 2023
e95a0fd
Added a test to verify the local system of a quadrilateral condition
avdg81 Dec 7, 2023
56e0f77
Renamed a data member to comply with the Kratos Style Guide
avdg81 Dec 7, 2023
124d6de
Made a `public` data member `private`
avdg81 Dec 7, 2023
db184c5
Removed an unused data member
avdg81 Dec 7, 2023
ee9732b
Removed a needless `override`
avdg81 Dec 7, 2023
779944f
Removed a data member that was only assigned, but never used
avdg81 Dec 7, 2023
cafd671
Inlined member function `CalculateKinematics`
avdg81 Dec 7, 2023
841c4e2
Removed some redundant comments, separation lines, and blank lines
avdg81 Dec 7, 2023
4b44a2a
Improved several minor issues
avdg81 Dec 7, 2023
bcf309d
Improved the signature of a member function
avdg81 Dec 7, 2023
a085678
Removed a redundant resize operation
avdg81 Dec 8, 2023
ce7db2c
Converted a data member to a local variable
avdg81 Dec 8, 2023
ae7753c
Removed a needless assignment
avdg81 Dec 8, 2023
545f01b
Converted a data member to a local variable
avdg81 Dec 8, 2023
6a2c1d7
Removed a needless assignment
avdg81 Dec 8, 2023
223facb
Converted data member `previousRadiation` to a local variable
avdg81 Dec 8, 2023
fedec1b
Removed the destructor that had a default implementation
avdg81 Dec 8, 2023
e0260f6
The `protected` members are now `private`
avdg81 Dec 8, 2023
57aa1cc
Removed an unused local variable
avdg81 Dec 8, 2023
ecaa145
Removed a needless resize operation
avdg81 Dec 8, 2023
037d53f
No need to pass data members to `private` member functions
avdg81 Dec 8, 2023
30f8ddf
No need to pass data members to `private` member functions
avdg81 Dec 8, 2023
742d9a6
No need to pass data members to `private` member functions
avdg81 Dec 8, 2023
ecf0b68
No need to pass data members to `private` member functions
avdg81 Dec 8, 2023
5cb0788
No need to pass data members to `private` member functions
avdg81 Dec 8, 2023
52a7ba5
No need to pass data members to `private` member functions
avdg81 Dec 8, 2023
7c4b769
Removed a redundant calculation of `TMatrix`
avdg81 Dec 8, 2023
08c6565
Added the integration tests from Mohamed's original branch
avdg81 Dec 8, 2023
0028b05
Converted data member `TMatrix` to local variables
avdg81 Dec 8, 2023
d04b0c0
Renamed local variables `TTMatrix` to `flux_matrix`
avdg81 Dec 8, 2023
8bd033d
Converted data member `TVector` to a local variable
avdg81 Dec 8, 2023
a6e97de
Changed a fixed size array to an unbounded vector
avdg81 Dec 8, 2023
6e9c36f
Added a utility function to get nodal values
avdg81 Dec 8, 2023
ac73980
Removed unused data member `DtTemperatureVector`
avdg81 Dec 8, 2023
ce0f5f7
Inlined member function `InitializeNodalTemperatureVariables`
avdg81 Dec 8, 2023
4ad7d2c
Replaced data member `TemperatureVector` by a local variable
avdg81 Dec 8, 2023
b68acdf
Eliminated alias `VectorType`
avdg81 Dec 8, 2023
f6497e8
Eliminated alias `MatrixType`
avdg81 Dec 8, 2023
8160a16
Member `GetNodalValues` now receives an output iterator
avdg81 Dec 8, 2023
b81a852
Removed unused member `detJContainer`
avdg81 Dec 8, 2023
0e6a7c4
Converted member `NContainer` to a local variable
avdg81 Dec 8, 2023
238983a
Inlined member `InitializeElementVariables`
avdg81 Dec 8, 2023
e90ec4b
Eliminated alias `NodeType`
avdg81 Dec 8, 2023
4c0585f
Eliminated alias `PropertiesType`
avdg81 Dec 8, 2023
ed9b20c
Cleaned up the constructors
avdg81 Dec 8, 2023
a4d5a91
Cleaned up member `Create`
avdg81 Dec 8, 2023
d0d6622
Use `MathUtils<>::Norm` to calculate the L2 norm of a vector
avdg81 Dec 10, 2023
684b370
Added a helper function for creating `Vector` objects
avdg81 Dec 10, 2023
7694160
Use `MathUtils<>::Norm` to calculate the L2 norm of a vector
avdg81 Dec 10, 2023
77b0224
Use `MathUtils<>::CrossProduct` to calculate a cross product
avdg81 Dec 10, 2023
6db7c26
Removed two needless resizing operations
avdg81 Dec 10, 2023
eff2bd5
Extracted member `albedoCoefficient` from `ElementVariables`
avdg81 Dec 10, 2023
6fe5d50
Extracted member `firstCoverStorageCoefficient` from `ElementVariables`
avdg81 Dec 10, 2023
8cfd73a
Extracted member `secondCoverStorageCoefficient` from `ElementVariables`
avdg81 Dec 10, 2023
ec89f45
Extracted member `secondCoverStorageCoefficient` from `ElementVariables`
avdg81 Dec 10, 2023
210985e
Extracted member `buildEnvironmentRadiation` from `ElementVariables`
avdg81 Dec 10, 2023
e0a23ed
Extracted member `minimalStorage` from `ElementVariables`
avdg81 Dec 10, 2023
eccff76
Extracted member `maximalStorage` from `ElementVariables`
avdg81 Dec 10, 2023
f9ad62c
Extracted member `roughnessTemperature` from `ElementVariables`
avdg81 Dec 10, 2023
26ceb96
Extracted member `netRadiation` from `ElementVariables`
avdg81 Dec 10, 2023
c211cbc
Extracted member `waterStorage` from `ElementVariables`
avdg81 Dec 10, 2023
906cd2a
Inlined member function `CalculateAll`
avdg81 Dec 10, 2023
ed40478
A few minor improvements
avdg81 Dec 10, 2023
7e82f11
Extracted a function that calculates the net radiation
avdg81 Dec 11, 2023
c8b90dd
Renamed several local variables and function parameters
avdg81 Dec 11, 2023
3c6e04e
Renamed more local variables and a function parameter
avdg81 Dec 11, 2023
b479fcc
Renamed more local variables and a function parameter
avdg81 Dec 11, 2023
501f5f1
Several minor improvements
avdg81 Dec 11, 2023
545a289
Reworked the calculations of the evaporation and precipitation
avdg81 Dec 11, 2023
03b4f77
Adding MicroClimateConstants namespace and split out setting the left…
rfaasse Dec 12, 2023
9dab74c
Split up the calculate nodal fluxes into smaller functions
rfaasse Dec 12, 2023
33081fa
Added a helper function to create diagonal matrices
avdg81 Dec 12, 2023
99d001b
Clarified and renamed some functions
rfaasse Dec 12, 2023
23d5c31
Merge branch 'geo/11866-add-micro-climate-condition' of https://githu…
rfaasse Dec 12, 2023
b237215
Moved more constants to the micro_climate_constants.h
rfaasse Dec 12, 2023
2abfd1b
Separate out setting the net radiation and left hand side fluxes
rfaasse Dec 12, 2023
fece922
Separate out the setting of water storage and right hand side fluxes
rfaasse Dec 12, 2023
71b8f0b
Removed lefthandside flux from member variable, since it's only neede…
rfaasse Dec 12, 2023
f9d6b7f
Eliminated field `Np` from `ElementVariables`
avdg81 Dec 12, 2023
7759759
Eliminated field `IntegrationCoefficient` from `ElementVariables`
avdg81 Dec 12, 2023
c52ee8f
Moved righthandside vector out of the member struct since it was only…
rfaasse Dec 13, 2023
f563872
Clarified the use of the net radiation/storage and removed function t…
rfaasse Dec 13, 2023
c5cf7bc
Renamed the constants in micro_climate_constants.h to match the style…
rfaasse Dec 13, 2023
d857cdf
Moving around functions and making relevant functions const
rfaasse Dec 13, 2023
bc015cc
Continued to reorder functions
avdg81 Dec 13, 2023
2b202aa
Removed the remaining redundant `this->` usages
avdg81 Dec 13, 2023
0fcfbc6
Reformatted the entire `.hpp` file with clang-format
avdg81 Dec 13, 2023
a5ec227
Renamed `.hpp` file to `.h`
avdg81 Dec 13, 2023
2284fd6
Extracted a function to calculate the surface roughness factor
avdg81 Dec 13, 2023
f22bbe0
Fixed the initialization with an explanation and revalidated the UT r…
rfaasse Dec 14, 2023
68218f1
Renamed a few local variables
avdg81 Dec 13, 2023
070cf4f
Renamed several function parameters to comply with the style guide
avdg81 Dec 14, 2023
b67b4ea
Removed trailing white spaces (codacy)
rfaasse Dec 14, 2023
3d08ab0
Moved the calculation of the integration coefficient
avdg81 Dec 14, 2023
a884b08
Reuse the function to calculate the integration coefficient
avdg81 Dec 14, 2023
9cb81db
Use `elemen_prod` for elementwise vector multiplications
avdg81 Dec 14, 2023
bbcc26a
Simplified a function's implementation
avdg81 Dec 15, 2023
45b13d1
Rewrote summing the net radiation using std::accumulate
rfaasse Dec 15, 2023
8e3164d
Removed two unused material parameters from the new input files
avdg81 Dec 15, 2023
b2c88ea
Processing part of the review comments
rfaasse Dec 15, 2023
a8efb38
Implemented save/load for the microclimate condition members
rfaasse Dec 15, 2023
ad69262
Reading water density from file instead of setting it a constant
rfaasse Dec 15, 2023
96e4168
Fixed the calculation of the current net radiation
avdg81 Dec 15, 2023
4739d67
Renamed a local variable
avdg81 Dec 15, 2023
f8a9bfd
Prepended the micro climate condition class name with `Geo`
avdg81 Dec 15, 2023
d0df38b
Corrected the qualification of the `Initialize` call
avdg81 Dec 15, 2023
2f46c12
Replaced a <Tab> by spaces
avdg81 Dec 15, 2023
50cb9ae
Merge remote-tracking branch 'origin/master' into geo/11866-add-micro…
avdg81 Dec 15, 2023
bdd4195
Fixed a compile-time error from GCC and Clang
avdg81 Dec 15, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
// KRATOS___
// // ) )
// // ___ ___
// // ____ //___) ) // ) )
// // / / // // / /
// ((____/ / ((____ ((___/ / MECHANICS
//
// License: geo_mechanics_application/license.txt
//
//
// Main authors: Mohamed Nabi
//

#pragma once

// Project includes
#include "includes/serializer.h"

// Application includes
#include "custom_conditions/T_condition.h"
#include "custom_utilities/condition_utilities.hpp"
#include "custom_utilities/element_utilities.hpp"
#include "geo_mechanics_application_variables.h"

namespace Kratos
{

struct WaterFluxes
{
double precipitation = 0.0;
double evaporation = 0.0;
};

template <unsigned int TDim, unsigned int TNumNodes>
class KRATOS_API(GEO_MECHANICS_APPLICATION) TMicroClimateFluxCondition
avdg81 marked this conversation as resolved.
Show resolved Hide resolved
: public GeoTCondition<TDim, TNumNodes>
{
public:
KRATOS_CLASS_INTRUSIVE_POINTER_DEFINITION(TMicroClimateFluxCondition);

using IndexType = std::size_t;
using GeometryType = Geometry<Node>;
using NodesArrayType = GeometryType::PointsArrayType;

TMicroClimateFluxCondition() : GeoTCondition<TDim, TNumNodes>() {}

TMicroClimateFluxCondition(IndexType NewId, GeometryType::Pointer pGeometry)
: GeoTCondition<TDim, TNumNodes>(NewId, pGeometry)
{
}

TMicroClimateFluxCondition(IndexType NewId,
GeometryType::Pointer pGeometry,
Properties::Pointer pProperties)
: GeoTCondition<TDim, TNumNodes>(NewId, pGeometry, pProperties)
{
}

Condition::Pointer Create(IndexType NewId,
const NodesArrayType& rNodes,
Properties::Pointer pProperties) const override;

void Initialize(const ProcessInfo& rCurrentProcessInfo) override;

void InitializeSolutionStep(const ProcessInfo& rCurrentProcessInfo) override;

void CalculateLocalSystem(Matrix& rLeftHandSideMatrix,
Vector& rRightHandSideVector,
const ProcessInfo& rCurrentProcessInfo) override;

private:
void InitializeProperties();

void CalculateAndAddLHS(Matrix& rLeftHandSideMatrix,
const array_1d<double, TNumNodes>& rN,
double IntegrationCoefficient,
const array_1d<double, TNumNodes>& rLeftHandSideFluxes);

void CalculateAndAddRHS(Vector& rRightHandSideVector,
const array_1d<double, TNumNodes>& rN,
double IntegrationCoefficient,
const Vector& rNodalTemperatures,
const array_1d<double, TNumNodes>& rLeftHandSideFluxes,
const array_1d<double, TNumNodes>& rRightHandSideFluxes);

array_1d<double, TNumNodes> CalculateLeftHandSideFluxes() const;
array_1d<double, TNumNodes> CalculateRightHandSideFluxes(double TimeStepSize,
double PreviousStorage,
double PreviousRadiation) const;
double CalculateRightHandSideFlux(double NetRadiation,
double SurfaceHeatStorage,
double ActualEvaporation) const;

double CalculateCurrentWaterStorage(double TimeStepSize,
double PreviousStorage,
double PreviousRadiation) const;

double CalculateCurrentNetRadiation() const;
double CalculateNetRadiation(unsigned int NodeIndex) const;

double CalculateSurfaceHeatStorage(double TimeStepSize,
double PreviousRadiation,
double NetRadiation) const;

WaterFluxes CalculateWaterFluxes(unsigned int NodeIndex,
double TimeStepSize,
double PreviousStorage,
double NetRadiation,
double SurfaceHeatStorage) const;

double CalculatePotentialEvaporation(unsigned int NodeIndex,
double NetRadiation,
double SurfaceHeatStorage) const;

void CalculateRoughness(const ProcessInfo& rCurrentProcessInfo);

double CalculateSurfaceRoughnessFactor(double CurrentAirTemperature,
double PreviousRoughnessTemperature,
double RichardsonBulkModulus,
double FrictionDragCoefficient) const;

// Serialization
friend class Serializer;

void save(Serializer& rSerializer) const override
{
KRATOS_SERIALIZE_SAVE_BASE_CLASS(rSerializer, Condition)
}

void load(Serializer& rSerializer) override
{
KRATOS_SERIALIZE_LOAD_BASE_CLASS(rSerializer, Condition)
}

bool mIsInitialized = false;
double mAlbedoCoefficient = 0.0;
double mFirstCoverStorageCoefficient = 0.0;
double mSecondCoverStorageCoefficient = 0.0;
double mThirdCoverStorageCoefficient = 0.0;
double mBuildEnvironmentRadiation = 0.0;
double mMinimalStorage = 0.0;
double mMaximalStorage = 0.0;
double mRoughnessTemperature = 0.0;
double mNetRadiation = 0.0;
double mWaterStorage = 0.0;
};

// class TMicroClimateFluxCondition.

} // namespace Kratos.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

// Application includes
#include "custom_conditions/T_normal_flux_condition.h"
#include "custom_utilities/condition_utilities.hpp"
#include "utilities/math_utils.h"

namespace Kratos {
Expand Down Expand Up @@ -73,8 +74,10 @@ void GeoTNormalFluxCondition<TDim, TNumNodes>::CalculateRHS(Vector& rRightHandSi
// Interpolation of nodal normal flux to integration point normal flux.
auto normal_flux_on_integration_point = MathUtils<>::Dot(N, normal_flux_vector);

auto weighting_integration_coefficient = CalculateIntegrationCoefficient(j_container[integration_point],
r_integration_points[integration_point].Weight());
auto weighting_integration_coefficient =
ConditionUtilities::CalculateIntegrationCoefficient<TDim, TNumNodes>(
j_container[integration_point],
r_integration_points[integration_point].Weight());

// Contributions to the right hand side
auto normal_flux_on_DOF = normal_flux_on_integration_point * N * weighting_integration_coefficient;
Expand All @@ -83,22 +86,6 @@ void GeoTNormalFluxCondition<TDim, TNumNodes>::CalculateRHS(Vector& rRightHandSi
}
}

template <unsigned int TDim, unsigned int TNumNodes>
double GeoTNormalFluxCondition<TDim, TNumNodes>::CalculateIntegrationCoefficient(const Matrix& rJacobian,
double Weight)
{
Vector normal_vector = ZeroVector(TDim);

if constexpr (TDim == 2) {
normal_vector = column(rJacobian, 0);
}
else if constexpr (TDim == 3) {
MathUtils<double>::CrossProduct(normal_vector, column(rJacobian, 0),
column(rJacobian, 1));
}
return Weight * MathUtils<double>::Norm(normal_vector);
}

template class GeoTNormalFluxCondition<2, 2>;
template class GeoTNormalFluxCondition<2, 3>;
template class GeoTNormalFluxCondition<2, 4>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) GeoTNormalFluxCondition
void CalculateRHS(Vector& rRightHandSideVector,
const ProcessInfo& CurrentProcessInfo) override;

double CalculateIntegrationCoefficient(const Matrix& rJacobian,
double Weight);

private:
friend class Serializer;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// KRATOS___
// // ) )
// // ___ ___
// // ____ //___) ) // ) )
// // / / // // / /
// ((____/ / ((____ ((___/ / MECHANICS
//
// License: geo_mechanics_application/license.txt
//
// Main authors: Richard Faasse
//
#pragma once

namespace Kratos::MicroClimateConstants
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wise to have 1 place for definitions.

They seem a mix of material parameters and physical constants. Sadly some of them are redefinitions of already existing parameters.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We removed the redefinition of the water density and as seen in the other comment, the gravity constant is a bigger issue that we'd like to tackle seperately

{

constexpr static auto AirDensity = 1.18;
rfaasse marked this conversation as resolved.
Show resolved Hide resolved
constexpr static auto AirHeatCapacity = 1004.67;
constexpr static auto RoughnessLayerResistance = 30.0;
constexpr static auto LatentEvaporationHeat = 2.45e6;
constexpr static auto WaterDensity = 1e3;
avdg81 marked this conversation as resolved.
Show resolved Hide resolved
constexpr static auto PsychometricConstant = 0.63;
constexpr static auto SurfaceResistance = 30.0;

constexpr static auto RoughnessLayerHeight = 10.0;
constexpr static auto VonNeumannCoefficient = 0.4;
constexpr static auto MeasurementHeight = 10.0;
constexpr static auto RoughnessHeight = 1.0;
constexpr static auto GravitationalAcceleration = 9.81;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably the 4th redefinition of g that we have ( volumetric acceleration process, weights in waterloads etc. ) It really should be only 1 and 1 alone!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Completely agreed, however we would like to fix this for all places at once, instead of only for this one (and it's not clear right now where that 1 place would be yet)


constexpr static auto EffectiveEmissivity = 0.95;
constexpr static auto BoltzmannCoefficient = 5.67e-8;

} // namespace Kratos::MicroClimateConstants
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ PYBIND11_MODULE(KratosGeoMechanicsApplication,m)

KRATOS_REGISTER_IN_PYTHON_VARIABLE(m, DT_TEMPERATURE)
KRATOS_REGISTER_IN_PYTHON_VARIABLE(m, NORMAL_HEAT_FLUX)
KRATOS_REGISTER_IN_PYTHON_VARIABLE( m, AIR_TEMPERATURE )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentational difference.
Should the registrations always be there or can they be conditional?

Copy link
Contributor Author

@rfaasse rfaasse Dec 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replaced a tab with spaces.

I would propose to look at conditional registration of variables in a new issue. I think it is a bit out of scope, since we need to figure out how to do that properly (in a way that it also works for other conditionals)

markelov208 marked this conversation as resolved.
Show resolved Hide resolved
KRATOS_REGISTER_IN_PYTHON_VARIABLE( m, SOLAR_RADIATION )
KRATOS_REGISTER_IN_PYTHON_VARIABLE( m, AIR_HUMIDITY )
KRATOS_REGISTER_IN_PYTHON_VARIABLE( m, PRECIPITATION )
KRATOS_REGISTER_IN_PYTHON_VARIABLE( m, WIND_SPEED )


KRATOS_REGISTER_IN_PYTHON_3D_VARIABLE_WITH_COMPONENTS( m, FLUID_FLUX_VECTOR )
KRATOS_REGISTER_IN_PYTHON_3D_VARIABLE_WITH_COMPONENTS( m, LOCAL_FLUID_FLUX_VECTOR )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,23 @@ class ConditionUtilities
}
}

template <unsigned int TDim, unsigned int TNumNodes>
static double CalculateIntegrationCoefficient(const Matrix& rJacobian, double Weight)
{
auto normal_vector = Vector{TDim, 0.0};

if constexpr (TDim == 2)
{
normal_vector = column(rJacobian, 0);
}
else if constexpr (TDim == 3)
{
MathUtils<>::CrossProduct(normal_vector, column(rJacobian, 0),
column(rJacobian, 1));
}
return Weight * MathUtils<>::Norm(normal_vector);
}

}; /* Class ConditionUtilities*/
} /* namespace Kratos.*/

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// KRATOS___
// // ) )
// // ___ ___
// // ____ //___) ) // ) )
// // / / // // / /
// ((____/ / ((____ ((___/ / MECHANICS
//
// License: geo_mechanics_application/license.txt
//
//
// Main authors: Anne van de Graaf
//

#pragma once

#include <algorithm>

#include "containers/variable.h"

namespace Kratos
{

class VariablesUtilities
{
public:
template <typename GeometryType, typename OutputIt>
static OutputIt GetNodalValues(const GeometryType& rGeometry,
const Variable<double>& rNodalVariable,
OutputIt FirstOut)
{
return std::transform(rGeometry.begin(), rGeometry.end(), FirstOut,
[&rNodalVariable](const auto& node) {
return node.FastGetSolutionStepValue(rNodalVariable);
});
}
};

}
10 changes: 10 additions & 0 deletions applications/GeoMechanicsApplication/geo_mechanics_application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,16 @@ void KratosGeoMechanicsApplication::Register() {
KRATOS_REGISTER_CONDITION("GeoTNormalFluxCondition3D8N", mGeoTNormalFluxCondition3D8N)
KRATOS_REGISTER_CONDITION("GeoTNormalFluxCondition3D9N", mGeoTNormalFluxCondition3D9N)

KRATOS_REGISTER_CONDITION("GeoTMicroClimateFluxCondition2D2N", mGeoTMicroClimateFluxCondition2D2N)
KRATOS_REGISTER_CONDITION("GeoTMicroClimateFluxCondition2D3N", mGeoTMicroClimateFluxCondition2D3N)
KRATOS_REGISTER_CONDITION("GeoTMicroClimateFluxCondition2D4N", mGeoTMicroClimateFluxCondition2D4N)
KRATOS_REGISTER_CONDITION("GeoTMicroClimateFluxCondition2D5N", mGeoTMicroClimateFluxCondition2D5N)
KRATOS_REGISTER_CONDITION("GeoTMicroClimateFluxCondition3D3N", mGeoTMicroClimateFluxCondition3D3N)
KRATOS_REGISTER_CONDITION("GeoTMicroClimateFluxCondition3D4N", mGeoTMicroClimateFluxCondition3D4N)
KRATOS_REGISTER_CONDITION("GeoTMicroClimateFluxCondition3D6N", mGeoTMicroClimateFluxCondition3D6N)
KRATOS_REGISTER_CONDITION("GeoTMicroClimateFluxCondition3D8N", mGeoTMicroClimateFluxCondition3D8N)
KRATOS_REGISTER_CONDITION("GeoTMicroClimateFluxCondition3D9N", mGeoTMicroClimateFluxCondition3D9N)

//Register Constitutive Laws
KRATOS_REGISTER_CONSTITUTIVE_LAW("BilinearCohesive3DLaw", mBilinearCohesive3DLaw)
KRATOS_REGISTER_CONSTITUTIVE_LAW("BilinearCohesive2DLaw", mBilinearCohesive2DLaw)
Expand Down
12 changes: 12 additions & 0 deletions applications/GeoMechanicsApplication/geo_mechanics_application.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

// conditions
#include "custom_conditions/Pw_normal_flux_condition.hpp"
#include "custom_conditions/T_microclimate_flux_condition.h"
#include "custom_conditions/T_normal_flux_condition.h"
#include "custom_conditions/U_Pw_face_load_condition.hpp"
#include "custom_conditions/U_Pw_face_load_interface_condition.hpp"
Expand Down Expand Up @@ -535,6 +536,17 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) KratosGeoMechanicsApplication : publ
const GeoTNormalFluxCondition<3, 8> mGeoTNormalFluxCondition3D8N{ 0, Kratos::make_shared< Quadrilateral3D8 <NodeType> >(Condition::GeometryType::PointsArrayType(8)) };
const GeoTNormalFluxCondition<3, 9> mGeoTNormalFluxCondition3D9N{ 0, Kratos::make_shared< Quadrilateral3D9 <NodeType> >(Condition::GeometryType::PointsArrayType(9)) };

const TMicroClimateFluxCondition<2, 2> mGeoTMicroClimateFluxCondition2D2N{0, Kratos::make_shared<Line2D2 <NodeType>>(Condition::GeometryType::PointsArrayType(2))};
const TMicroClimateFluxCondition<2, 3> mGeoTMicroClimateFluxCondition2D3N{0, Kratos::make_shared<Line2D3 <NodeType>>(Condition::GeometryType::PointsArrayType(3))};
const TMicroClimateFluxCondition<2, 4> mGeoTMicroClimateFluxCondition2D4N{0, Kratos::make_shared<Line2D4 <NodeType>>(Condition::GeometryType::PointsArrayType(4))};
const TMicroClimateFluxCondition<2, 5> mGeoTMicroClimateFluxCondition2D5N{0, Kratos::make_shared<Line2D5 <NodeType>>(Condition::GeometryType::PointsArrayType(5))};
const TMicroClimateFluxCondition<3, 3> mGeoTMicroClimateFluxCondition3D3N{0, Kratos::make_shared<Triangle3D3 <NodeType>>(Condition::GeometryType::PointsArrayType(3))};
const TMicroClimateFluxCondition<3, 6> mGeoTMicroClimateFluxCondition3D6N{0, Kratos::make_shared<Triangle3D6 <NodeType>>(Condition::GeometryType::PointsArrayType(6))};
const TMicroClimateFluxCondition<3, 4> mGeoTMicroClimateFluxCondition3D4N{0, Kratos::make_shared<Quadrilateral3D4<NodeType>>(Condition::GeometryType::PointsArrayType(4))};
const TMicroClimateFluxCondition<3, 8> mGeoTMicroClimateFluxCondition3D8N{0, Kratos::make_shared<Quadrilateral3D8<NodeType>>(Condition::GeometryType::PointsArrayType(8))};
const TMicroClimateFluxCondition<3, 9> mGeoTMicroClimateFluxCondition3D9N{0, Kratos::make_shared<Quadrilateral3D9<NodeType>>(Condition::GeometryType::PointsArrayType(9))};


rfaasse marked this conversation as resolved.
Show resolved Hide resolved
// constitutive models
const BilinearCohesive3DLaw mBilinearCohesive3DLaw;
const BilinearCohesive2DLaw mBilinearCohesive2DLaw;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,11 @@ def _add_temperature_variables(self):
self.main_model_part.AddNodalSolutionStepVariable(GeoMechanicsApplication.DT_TEMPERATURE)
# Add variables for the heat conditions
self.main_model_part.AddNodalSolutionStepVariable(GeoMechanicsApplication.NORMAL_HEAT_FLUX)
self.main_model_part.AddNodalSolutionStepVariable(GeoMechanicsApplication.AIR_TEMPERATURE)
rfaasse marked this conversation as resolved.
Show resolved Hide resolved
self.main_model_part.AddNodalSolutionStepVariable(GeoMechanicsApplication.SOLAR_RADIATION)
self.main_model_part.AddNodalSolutionStepVariable(GeoMechanicsApplication.AIR_HUMIDITY)
self.main_model_part.AddNodalSolutionStepVariable(GeoMechanicsApplication.PRECIPITATION)
self.main_model_part.AddNodalSolutionStepVariable(GeoMechanicsApplication.WIND_SPEED)

def _add_smoothing_variables(self):
self.main_model_part.AddNodalSolutionStepVariable(KratosMultiphysics.NODAL_AREA)
Expand Down
Loading
Loading