Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion applications/solvers/dfLowMachFoam/UEqn.H
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ end1 = std::clock();
boundary_pressure_init, boundary_velocity_init, boundary_nuEff_init, boundary_rho_init);
UEqn_GPU.fvc_grad(&p[0]);
UEqn_GPU.fvc_grad_vector();
UEqn_GPU.divDevRhoReff();
UEqn_GPU.dev2T();
UEqn_GPU.fvc_div_tensor(&nuEff[0]);
UEqn_GPU.fvm_laplacian();
end1 = std::clock();
Expand Down
6 changes: 4 additions & 2 deletions applications/solvers/dfLowMachFoam/createdfSolver.H
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ int num_boundary_cells;
string settingPath;
settingPath = CanteraTorchProperties.subDict("AmgxSettings").lookupOrDefault("UEqnSettingPath", string(""));

dfMatrix UEqn_GPU(num_surfaces, num_cells, num_boundary_faces, num_boundary_cells, &neighbour[0], &owner[0], &mesh.V()[0], &mesh.surfaceInterpolation::weights()[0],
&mesh.Sf()[0][0], &mesh.magSf()[0], &mesh.nonOrthDeltaCoeffs()[0], boundary_face_vector_init, boundary_face_init, boundary_deltaCoeffs_init, boundaryCellIndex, "dDDI", settingPath);
dfMatrixDataBase dfDataBase(num_surfaces, num_cells, num_boundary_faces, num_boundary_cells, &neighbour[0], &owner[0], &mesh.V()[0], &mesh.surfaceInterpolation::weights()[0],
&mesh.Sf()[0][0], &mesh.magSf()[0], &mesh.nonOrthDeltaCoeffs()[0], boundary_face_vector_init, boundary_face_init, boundary_deltaCoeffs_init, boundaryCellIndex);

dfUEqn UEqn_GPU(dfDataBase, "dDDI", settingPath);

double *ueqn_internalCoeffs_init, *ueqn_boundaryCoeffs_init, *boundary_pressure_init, *boundary_velocity_init,
*boundary_nuEff_init, *boundary_rho_init, *ueqn_laplac_internalCoeffs_init, *ueqn_laplac_boundaryCoeffs_init;
Expand Down
2 changes: 1 addition & 1 deletion applications/solvers/dfLowMachFoam/dfLowMachFoam.C
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Description
#include "basicThermo.H"
#include "CombustionModel.H"

#include "dfMatrix.H"
#include "dfUEqn.H"
#include <cuda_runtime.h>
#include <thread>

Expand Down
2 changes: 1 addition & 1 deletion src_gpu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ include_directories(
$ENV{AMGX_DIR}/include
)

add_library(${PROJECT_NAME} SHARED dfMatrix.cu AmgXSolver.cu)
add_library(${PROJECT_NAME} SHARED dfUEqn.cu AmgXSolver.cu)

target_link_libraries(${PROJECT_NAME}
${MPI_LIBRARIES}
Expand Down
23 changes: 23 additions & 0 deletions src_gpu/GPUMesh.H
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include <iostream>

class GPUMesh
{
public:
int num_cells;
int num_faces;
int boundary_cells;
//... all variables needed to upload once

public:
GPUMesh();
~GPUMesh();
};

GPUMesh::GPUMesh()
{
// same to the constructor of dfMatrix.C
}

GPUMesh::~GPUMesh()
{
}
57 changes: 57 additions & 0 deletions src_gpu/GPUfield.H
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
GPU field
UEqn
GPUField
rho_old, rho_new, vector_old, phi, p, nuEff,
p_bou, vector_old_bou, nuEff_bou, rho_new_bou,
ueqn_internalCoeffs, ueqn_boundaryCoeffs_init, ueqn_laplac_internalCoeffs_init, ueqn_laplac_boundaryCoeffs_init
1. initialize a map
2. implement methods to construct GPU pointer and return GPU pointer

fvm__ddt(UEqn, rho, U)
{
rho.oldtime()
rho.
}
*/
#include <iostream>
#include <unordered_map>

#define TOSTRING(x) #x

struct GPUField {
double* cur_internal;
double* cur_boundary;
double* old_internal;
double* old_boundary;
};
std::unordered_map<std::string, GPUField> GPUFields;

// initialize: cudaMalloc, conducted at begining
void initialize(std::string U, std::string p, std::string phi);
// Q:
// 1. consider the different sizes bettween face values and cell values
// 2. not all variables need all these four terms

// update at the end of this time step
// move current pointer as oldTime pointer
void update();

template<class Type, template<class> class PatchField, class GeoMesh>
double* cur_internal(Foam::GeometryField<Type, PatchField, GeoMesh> var)
{
if (!GPUFields[TOSTRING(var)].cur_internal) {
// 1. cudaMemcopy current internal field
}
return GPUFields[TOSTRING(var)].cur_internal;
}

template<class Type, template<class> class PatchField, class GeoMesh>
double* cur_boundary(Foam::GeometryField<Type, PatchField, GeoMesh> var);

template<class Type, template<class> class PatchField, class GeoMesh>
double* old_internal(Foam::GeometryField<Type, PatchField, GeoMesh> var);

template<class Type, template<class> class PatchField, class GeoMesh>
double* old_boundary(Foam::GeometryField<Type, PatchField, GeoMesh> var);

18 changes: 18 additions & 0 deletions src_gpu/GPUfield.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
GPU field
UEqn
GPUField
rho_old, rho_new, vector_old, phi, p, nuEff,
p_bou, vector_old_bou, nuEff_bou, rho_new_bou,
ueqn_internalCoeffs, ueqn_boundaryCoeffs_init, ueqn_laplac_internalCoeffs_init, ueqn_laplac_boundaryCoeffs_init
1. initialize a map
2. implement methods to construct GPU pointer and return GPU pointer

fvm__ddt(UEqn, rho, U)
{
rho.oldtime()
rho.
}
*/
#include <stdio.h>

217 changes: 0 additions & 217 deletions src_gpu/dfMatrix.H

This file was deleted.

Loading