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

WIP: Traction calculation in Cardinal #794

Draft
wants to merge 26 commits into
base: devel
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
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
3 changes: 3 additions & 0 deletions doc/content/source/problems/output_solution.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ This output feature is used by specifying the fields to be output with the
- `scalar01` (which creates a MOOSE variable named `scalar01`)
- `scalar02` (which creates a MOOSE variable named `scalar02`)
- `scalar03` (which creates a MOOSE variable named `scalar03`)
- `ros_tensor` (which creates MOOSE variables named `ros_s11`, `ros_s22`,..,`ros_s13`)
- `wall_shear` (which creates a MOOSE variable named `wall_shear`)
- `traction` (which creates MOOSE variables named `traction_x`,`traction_y`,`traction_z`)

For NekRS simulations that are coupled to MOOSE, the temperature will already
be output because it is used as part of the physics transfers.
Expand Down
11 changes: 11 additions & 0 deletions include/base/CardinalEnums.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,17 @@ enum NekFieldEnum
scalar01,
scalar02,
scalar03,
wall_shear,
traction,
traction_x,
traction_y,
traction_z,
ros_s11,
ros_s22,
ros_s33,
ros_s12,
ros_s23,
ros_s13,
unity
};

Expand Down
124 changes: 124 additions & 0 deletions include/base/NekInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@ namespace nekrs

static int build_only;

/// initialize wall shear stress variable
void initializeWallShear();

/// initialize traction variable for FSI or standalone traction calculations
void initializeTraction();

/// initialize rate of strain tensor components
void initializeRateOfStrainTensor();

/// Allocate memory for the host mesh parameters
void initializeHostMeshParameters();

Expand All @@ -55,6 +64,9 @@ void updateHostMeshParameters();

dfloat * getSgeo();
dfloat * getVgeo();
double * getWallShear();
double * getTraction();
double * getRateOfStrainTensor();

/**
* Set the absolute tolerance for checking energy conservation in data transfers to Nek
Expand Down Expand Up @@ -556,6 +568,41 @@ void limitTemperature(const double * min_T, const double * max_T);
void gradient(const int offset, const double * f, double * grad_f,
const nek_mesh::NekMeshEnum pp_mesh);

/**
* Compute the direct stiffness sum (dssum) and then average at element boundaries. Similar to the dsavg subroutine from Nek5000
* @param[in] u field to perform the dssum and average on
* @param[in] pp_mesh NekRS mesh to operate on
*/
void nekDirectStiffnessAvg(double * u, const nek_mesh::NekMeshEnum pp_mesh);

/**
* Compute the rate of strain tensor on the Nek mesh
* @param[in] S_ij pointer to store the rate of strain tensor
* @param[in] pp_mesh NekRS mesh to operate on
*/
void computeRateOfStrainTensor(double * S_ij, const nek_mesh::NekMeshEnum pp_mesh);

/**
* Compute the stress tensor on the Nek mesh
* @param[in] Tau_ij pointer to store the stress tensor
* @param[in] pp_mesh NekRS mesh to operate on
*/
void computeStressTensor(double * Tau_ij,const nek_mesh::NekMeshEnum pp_mesh);

/**
* Compute the wall shear stress on a given boundary
* @param[in] wall_shear pointer to store the wall shear
* @param[in] pp_mesh NekRS mesh to operate on
*/
void computeWallShearStress(double * wall_shear, const nek_mesh::NekMeshEnum pp_mesh);

/**
* Compute the traction vectors on the solid-fluid boundary on the Nek mesh
* @param[in] traction pointer to store the 3 traction components
* @param[in] pp_mesh NekRS mesh to operate on
*/
void computeTraction(double * traction, const nek_mesh::NekMeshEnum pp_mesh);

/**
* Find the extreme value of a given field over the entire nekRS domain
* @param[in] field field to find the minimum value of
Expand Down Expand Up @@ -821,6 +868,83 @@ double velocity_z(const int id);
*/
double velocity(const int id);

/**
* Get the wall shear at given GLL index
* @param[in] id GLL index
* @return wall shear at index
*/
double wall_shear(const int id);

/**
* Get the traction at given GLL index
* @param[in] id GLL index
* @return traction at index
*/
double traction(const int id);

/**
* Get the x-traction at given GLL index
* @param[in] id GLL index
* @return x-traction at index
*/
double traction_x(const int id);

/**
* Get the y-traction at given GLL index
* @param[in] id GLL index
* @return y-traction at index
*/
double traction_y(const int id);

/**
* Get the z-traction at given GLL index
* @param[in] id GLL index
* @return z-traction at index
*/
double traction_z(const int id);

/**
* Get the magnitude of the rate-of-strain tensor component S_{11} at given GLL index
* @param[in] id GLL index
* @return S_{11} magnitude at index
*/
double ros_s11(const int id);

/**
* Get the magnitude of the rate-of-strain tensor component S_{22} at given GLL index
* @param[in] id GLL index
* @return S_{22} magnitude at index
*/
double ros_s22(const int id);

/**
* Get the magnitude of the rate-of-strain tensor component S_{33} at given GLL index
* @param[in] id GLL index
* @return S_{33} magnitude at index
*/
double ros_s33(const int id);

/**
* Get the magnitude of the rate-of-strain tensor component S_{12} at given GLL index
* @param[in] id GLL index
* @return S_{12} magnitude at index
*/
double ros_s12(const int id);

/**
* Get the magnitude of the rate-of-strain tensor component S_{23} at given GLL index
* @param[in] id GLL index
* @return S_{23} magnitude at index
*/
double ros_s23(const int id);

/**
* Get the magnitude of the rate-of-strain tensor component S_{13} at given GLL index
* @param[in] id GLL index
* @return S_{13} magnitude at index
*/
double ros_s13(const int id);

/**
* Write a value into the user scratch space that holds the flux
* @param[in] id index
Expand Down
4 changes: 3 additions & 1 deletion src/base/CardinalEnums.C
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ MooseEnum
getNekFieldEnum()
{
return MooseEnum(
"velocity_component velocity_x velocity_y velocity_z velocity temperature pressure scalar01 scalar02 scalar03 unity");
"velocity_component velocity_x velocity_y velocity_z velocity temperature"
" pressure scalar01 scalar02 scalar03 wall_shear traction traction_x traction_y traction_z"
" ros_s11 ros_s22 ros_s33 ros_s12 ros_s23 ros_s13 unity");
}

MooseEnum
Expand Down
Loading