Skip to content

Commit

Permalink
Added an open-source version of the VCP3D solver.
Browse files Browse the repository at this point in the history
  • Loading branch information
inquisitor101 committed Nov 2, 2023
1 parent ef21727 commit 349b887
Show file tree
Hide file tree
Showing 40 changed files with 3,257 additions and 691 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# VCP3D_Open

This is an extension of an in-house discontinuous Galerkin (DG-)Finite Element Method (FEM) code developed by Edwin van der Weide, such that it can handle open boundary conditions using the polynomial-correction (PC-)Navier-Stokes Characteristic boundary condition (NSCBC).
This is an open-source version of an in-house single-block discontinuous Galerkin (DG-)Finite Element Method (FEM) code developed by Edwin van der Weide. My current contribution was to extend its capabilities, such that it is able handle open boundary via non-reflective boundary conditions (NRBCs). The NRBCs considered in this code are:

* Polynomial-Correction (PC-)Navier-Stokes Characteristic Boundary Condition (NSCBC).
* Characteristic Matching Layer (CML).
* Sponge Layer.

15 changes: 15 additions & 0 deletions VCP3D_CurviLinear/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true

# Matches multiple files with brace expansion notation
[*.{cpp,hpp}]
charset = utf-8
indent_style = tab
indent_size = 2
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false
52 changes: 52 additions & 0 deletions VCP3D_CurviLinear/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Prerequisites
*.d

# Compiled Object files
*.slo
*.lo
*.o
*.obj
*.optrpt
*.pyc

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app


# Ignore binary directory.
bin/

# Log files.
*.log

# Swap files.
*.swp

# VTK files.
*.vtk

# Data files.
*.data


37 changes: 35 additions & 2 deletions VCP3D_CurviLinear/include/ElementClass.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,25 @@ class ElementClass
// The local indices of the element.
int mLocalInd[3];

// Whether or not this is a sponge layer element. Default is false.
bool mSpongeLayerElement;

// Whether this is a sponge layer in each direction. Default is false.
bool mSpongeXMIN;
bool mSpongeXMAX;
bool mSpongeYMIN;
bool mSpongeYMAX;
bool mSpongeZMIN;
bool mSpongeZMAX;

// Matching layer scaling factors used in the damping function normalization.
su2double mMatchingScaleXMIN;
su2double mMatchingScaleXMAX;
su2double mMatchingScaleYMIN;
su2double mMatchingScaleYMAX;
su2double mMatchingScaleZMIN;
su2double mMatchingScaleZMAX;

// Vector of arrays with the coordinates of the nodal grid DOFs.
std::vector<su2double *> mCoorNodalGridDOFs;

Expand Down Expand Up @@ -78,6 +97,12 @@ class ElementClass
// Vector of arrays with the metric terms in the volume solution DOFs.
std::vector<su2double *> mVolMetricSolDOFs;

// Vector of arrays of the damping function in a sponge layer.
std::vector<su2double *> mDampingFunction;

// Vector of arrays of the target-state being damped against in a sponge layer.
std::vector<su2double *> mDampingState;

// Vector of arrays of the solution for the modal form.
std::vector<su2double *> mSol;

Expand All @@ -89,8 +114,8 @@ class ElementClass

// Array with the average of the eddy viscosity in the DOFs.
su2double *mAveEddyVis;
// Vector of arrays of the old solution for the modal form, needed for Runge Kutta.

// Vector of arrays of the old solution for the modal form, needed for Runge Kutta.
std::vector<su2double *> mSolOld;

// Vector of arrays of the residuals for the modal form.
Expand Down Expand Up @@ -388,6 +413,14 @@ class ElementClass
su2double &Mach2Max,
su2double &EddyVisMax);

// Function, which configures a sponge layer element.
void ConfigureSpongeLayer(const InputParamClass *inputParam,
const StandardElementClass *standardHex);

// Function, which initializes the damping state in a sponge layer.
void InitializeDampingState(const InputParamClass *inputParam,
const StandardElementClass *standardHex);

private:
//--------------------------------------
// Private member variables.
Expand Down
33 changes: 30 additions & 3 deletions VCP3D_CurviLinear/include/InputParamClass.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ class InputParamClass
// Function, which writes the header for the time step history.
void WriteHeaderTimeStepHistory(void);

// Function to read the sponge layer data.
void ReadSpongeLayerData(const char *fileName);


//------------------------------------------
// Public member variables.
//------------------------------------------
Expand Down Expand Up @@ -119,6 +123,10 @@ class InputParamClass
su2double mPulseStrength;
// Pulse radial width.
su2double mPulseWidth;
// Whether it is a 1D pulse.
bool mPulse1D;
// Direction of the 1D (x-)pulse.
su2double mPulseDirection1D;
// Quiescent flow simulation (all outlets, M = 0).
bool mQuiescentFlow;

Expand Down Expand Up @@ -231,10 +239,29 @@ class InputParamClass

// NSCBC inlet length scale.
su2double mNSCBC_Inlet_len;
// NSCBC inlet relaxation coefficient for normal wave amplitude.
// NSCBC inlet relaxation coefficient for normal wave amplitude.
su2double mNSCBC_Inlet_sigma;
// NSCBC inlet relaxation coefficient for transverse wave amplitude.
su2double mNSCBC_Inlet_beta;
// Type of reconstruction in the inlet NSCBC: whether or not to use
// the outgoing wave amplitude in the reconstruction process.
// Default is yes. Note, this means for a total inlet NSCBC, this is reflecting.
bool mNSCBC_Inlet_incoming;

// Whether or not to use a characteristic matching layer.
bool mCharacteristicMatchingLayer;

// Whether or not to use a sponge layer. Default is no.
bool mSpongeLayer;
// Whether or not a sponge layer is used, per block face.
bool mSpongeLayerSpecified[6];
// Number of elements in each layer, per block face.
int mNSpongeLayerElements[6];
// Damping constant in each layer, per block face.
su2double mDampingConstant[6];
// Damping exponent in each layer, per block face.
su2double mDampingExponent[6];

// Name of the averaged solution file used in a sponge layer.
std::string mAveragedSolutionFile;

private:
//------------------------------------------------
Expand Down
Loading

0 comments on commit 349b887

Please sign in to comment.