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

PCMS interpolation functionality #148

Open
wants to merge 50 commits into
base: develop
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
6aa1ca3
added adj_search.hpp header in MLSInterpolation.hpp file
abhiyan123 Sep 22, 2024
14f82b2
added regular grid linear interpolator and mls interpolator
abhiyan123 Sep 22, 2024
12a26bb
added interpolator subdirectory
abhiyan123 Sep 22, 2024
a3b97f3
added the interpolator folder with header files for MLS and linear me…
abhiyan123 Sep 22, 2024
e3ac60b
removed hdf5 header
abhiyan123 Sep 23, 2024
ec486e7
removed unnecessary files
abhiyan123 Sep 23, 2024
9ec0f44
Merge pull request #1 from abhiyanpaudel/interpolator
Fuad-HH Sep 24, 2024
749be28
enforce number of support
Fuad-HH Sep 24, 2024
cca0eca
can use any dimension and degree of polynomial
abhiyan123 Sep 24, 2024
418fb08
Merge branch 'mls_generalMLS' into general_mls
abhiyan123 Sep 24, 2024
1ddc29c
added test cases
abhiyan123 Sep 24, 2024
eda1048
moved interpolator folder to pcms
abhiyan123 Oct 10, 2024
b90cbaf
modified to incorporate interpolator
abhiyan123 Oct 10, 2024
5cd5869
updated the file
abhiyan123 Oct 10, 2024
92d0183
deleted unneceesary files
abhiyan123 Oct 10, 2024
5b72727
variable radius for degas2
Fuad-HH Oct 21, 2024
1bc767b
cleaned up the basis monomial calculation
abhiyan123 Oct 21, 2024
c052240
made it general
abhiyan123 Oct 21, 2024
8319c3d
updated the test cases that verifies the monomial basis calculations
abhiyan123 Oct 21, 2024
b9537dc
added unit test case that verifies the basis calculation
abhiyan123 Oct 21, 2024
174cf92
updated .gitignore file
abhiyan123 Oct 21, 2024
b65cee8
made changes to accomodate general mls procedure
abhiyan123 Oct 25, 2024
7021f91
compatible with the generalized mls
abhiyan123 Oct 28, 2024
723bcdf
added test case file name
abhiyan123 Oct 28, 2024
d5bd614
created the test case for generalized mls
abhiyan123 Oct 28, 2024
a14cf7d
merge general order interpolation changes from abhiyan's fork
Fuad-HH Oct 28, 2024
810b760
move include adj_search_dega2.hpp from MLSInterpolation.hpp to test_r…
Fuad-HH Oct 29, 2024
5609874
radius adaptation for adj_search
Fuad-HH Oct 29, 2024
f337543
added Nan Check
abhiyan123 Oct 29, 2024
726e6ff
formatted the files
abhiyan123 Oct 29, 2024
0b3b202
Merge pull request #7 from abhiyanpaudel/general_mls
Fuad-HH Oct 29, 2024
a7b5e33
revert clangformatting in CMakeLists.txt and remove const from suppor…
Fuad-HH Oct 29, 2024
1f60fe1
merge centroid->node interp with general
Fuad-HH Oct 31, 2024
a2b1563
refactor
Fuad-HH Nov 1, 2024
8e6873a
radius adaptation option added for cell2node search
Fuad-HH Nov 1, 2024
4c93f4a
renamed test sections
abhiyan123 Nov 11, 2024
cd88d53
interface for passing various rbf functions
abhiyan123 Nov 18, 2024
5acab5e
updated the CMake list to include the new files
abhiyan123 Nov 18, 2024
cc8e3d8
changes to accomodate interface
abhiyan123 Nov 18, 2024
ec57a6d
changes to accomodate interface
abhiyan123 Nov 18, 2024
c888f28
updated test CMake list
abhiyan123 Nov 18, 2024
27453c6
added pcms_interpolator target
abhiyan123 Dec 3, 2024
f9bd120
set target properties for pcms_interpolator
abhiyan123 Dec 3, 2024
2ba0322
updated with kokkos kernels LU solver
abhiyan123 Dec 3, 2024
52dc62a
upgraded to kokkos kernels
abhiyan123 Dec 3, 2024
10f0b51
add radial basis function choices for user
abhiyan123 Dec 3, 2024
8e8e7fb
added and updated test cases
abhiyan123 Dec 3, 2024
cf60f99
Merge pull request #14 from abhiyanpaudel/general_mls
Fuad-HH Dec 5, 2024
b1cfb1f
Merge branch develop into mls_interpolation
jacobmerson Dec 18, 2024
90b5218
make functions inline to compile
jacobmerson Dec 18, 2024
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
Prev Previous commit
Next Next commit
changes to accomodate interface
  • Loading branch information
abhiyan123 committed Nov 18, 2024
commit cc8e3d81a0e9c93f70569f675d76426422cc90ce
41 changes: 10 additions & 31 deletions src/pcms/interpolator/MLSCoefficients.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <Omega_h_fail.hpp>

#include "points.hpp"
#include <type_traits>

#define PI_M 3.14159265358979323846
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We should not define our own pi. We can use M_PI from cmath


Expand Down Expand Up @@ -93,32 +94,6 @@ void BasisPoly(ScratchVecView basis_monomial, const MatViewType& slice_length,
}
}

KOKKOS_INLINE_FUNCTION
double rbf(double r_sq, double rho_sq)
{
double phi;
double r = sqrt(r_sq);
OMEGA_H_CHECK_PRINTF(
rho_sq > 0, "ERROR: rho_sq in rbf has to be positive, but got %.16f\n",
rho_sq);
double rho = sqrt(rho_sq);
double ratio = r / rho;
double limit = 1 - ratio;
if (limit < 0) {
phi = 0;

} else {
phi = 5 * pow(ratio, 5) + 30 * pow(ratio, 4) + 72 * pow(ratio, 3) +
82 * pow(ratio, 2) + 36 * ratio + 6;
phi = phi * pow(limit, 6);
}

OMEGA_H_CHECK_PRINTF(!std::isnan(phi),
"ERROR: phi in rbf is NaN. r_sq, rho_sq = (%f, %f)\n",
r_sq, rho_sq);
return phi;
}

// create vandermondeMatrix
KOKKOS_INLINE_FUNCTION
void VandermondeMatrix(ScratchMatView V,
Expand Down Expand Up @@ -160,16 +135,20 @@ void PTphiMatrix(ScratchMatView pt_phi, ScratchMatView V, ScratchVecView Phi,
}

// radial basis function vector
KOKKOS_INLINE_FUNCTION
void PhiVector(ScratchVecView Phi, const Coord target_point,
const ScratchMatView local_source_points, int j,
double cuttoff_dis_sq)
template <typename Func,
std::enable_if_t<std::is_invocable_r_v<double, Func, double, double>,
bool> = true>
KOKKOS_INLINE_FUNCTION void PhiVector(ScratchVecView Phi,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Naming
Views by const ref

const Coord target_point,
const ScratchMatView local_source_points,
int j, double cuttoff_dis_sq,
Func rbf_func)
{
int N = local_source_points.extent(0);
double dx = target_point.x - local_source_points(j, 0);
double dy = target_point.y - local_source_points(j, 1);
double ds_sq = dx * dx + dy * dy;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Is this assuming 2D?

Phi(j) = rbf(ds_sq, cuttoff_dis_sq);
Phi(j) = rbf_func(ds_sq, cuttoff_dis_sq);
OMEGA_H_CHECK_PRINTF(!std::isnan(Phi(j)),
"ERROR: Phi(j) in PhiVector is NaN for j = %d "
"ds_sq=%.16f, cuttoff_dis_sq=%.16f",
Expand Down