@@ -1371,11 +1371,26 @@ void polympo_setSolveStressMesh_f(MPMesh_ptr p_mpmesh, const int nCells, int* ar
13711371 Kokkos::deep_copy (solveStress, h_solveStress);
13721372}
13731373
1374+ void polympo_setSolveVelocityMesh_f (MPMesh_ptr p_mpmesh, const int nVertices, int * array){
1375+ // chech validity
1376+ checkMPMeshValid (p_mpmesh);
1377+ auto p_mesh = ((polyMPO::MPMesh*)p_mpmesh)->p_mesh ;
1378+
1379+ PMT_ALWAYS_ASSERT (p_mesh->getNumVertices ()==nVertices);
1380+ // copy the host array to the device
1381+ auto solveVelocity = p_mesh->getMeshField <polyMPO::MeshF_SolveVelocity>();
1382+ auto h_solveVelocity = Kokkos::create_mirror_view (solveVelocity);
1383+ for (int i=0 ; i<nVertices; i++)
1384+ h_solveVelocity (i) = array[i];
1385+ Kokkos::deep_copy (solveVelocity, h_solveVelocity);
1386+ }
1387+
13741388void polympo_calculateStressDivergence_f (MPMesh_ptr p_mpmesh){
13751389 // chech validity
13761390 checkMPMeshValid (p_mpmesh);
13771391 ((polyMPO::MPMesh*)p_mpmesh) -> calculateStressDivergence ();
1378- }
1392+
1393+ }
13791394
13801395void polympo_getStressDivergence_f (MPMesh_ptr p_mpmesh, const int nVertices, double * uArray, double * vArray){
13811396 // chech validity
@@ -1394,6 +1409,109 @@ void polympo_getStressDivergence_f(MPMesh_ptr p_mpmesh, const int nVertices, dou
13941409 }
13951410}
13961411
1412+ void polympo_setTotalMassVtx_f (MPMesh_ptr p_mpmesh, const int nVertices, double * array){
1413+ checkMPMeshValid (p_mpmesh);
1414+ auto p_mesh = ((polyMPO::MPMesh*)p_mpmesh)->p_mesh ;
1415+
1416+ PMT_ALWAYS_ASSERT (p_mesh->getNumVertices ()==nVertices);
1417+ // copy the host array to the device
1418+ auto totalMassVtx = p_mesh->getMeshField <polyMPO::MeshF_TotalMassVtx>();
1419+ auto h_totalMassVtx = Kokkos::create_mirror_view (totalMassVtx);
1420+ for (int i=0 ; i<nVertices; i++)
1421+ h_totalMassVtx (i, 0 ) = array[i];
1422+ Kokkos::deep_copy (totalMassVtx, h_totalMassVtx);
1423+ }
1424+
1425+ void polympo_set_airStress_f (MPMesh_ptr p_mpmesh, const int nVertices, double * uArray, double * vArray){
1426+ // check mpMesh is valid
1427+ checkMPMeshValid (p_mpmesh);
1428+ auto p_mesh = ((polyMPO::MPMesh*)p_mpmesh)->p_mesh ;
1429+
1430+ // check the size
1431+ PMT_ALWAYS_ASSERT (p_mesh->getNumVertices ()==nVertices);
1432+
1433+ // copy the host array to the device
1434+ auto airStress = p_mesh->getMeshField <polyMPO::MeshF_AirStress>();
1435+ auto h_airStress = Kokkos::create_mirror_view (airStress);
1436+ for (int i=0 ; i<nVertices; i++){
1437+ h_airStress (i,0 ) = uArray[i];
1438+ h_airStress (i,1 ) = vArray[i];
1439+ }
1440+ Kokkos::deep_copy (airStress, h_airStress);
1441+ }
1442+
1443+ void polympo_set_surfaceTiltForce_f (MPMesh_ptr p_mpmesh, const int nVertices, double * uArray, double * vArray){
1444+ // check mpMesh is valid
1445+ checkMPMeshValid (p_mpmesh);
1446+ auto p_mesh = ((polyMPO::MPMesh*)p_mpmesh)->p_mesh ;
1447+
1448+ // check the size
1449+ PMT_ALWAYS_ASSERT (p_mesh->getNumVertices ()==nVertices);
1450+
1451+ // copy the host array to the device
1452+ auto surfTiltForce = p_mesh->getMeshField <polyMPO::MeshF_SurfaceTilt>();
1453+ auto h_surfTiltForce = Kokkos::create_mirror_view (surfTiltForce);
1454+ for (int i=0 ; i<nVertices; i++){
1455+ h_surfTiltForce (i,0 ) = uArray[i];
1456+ h_surfTiltForce (i,1 ) = vArray[i];
1457+ }
1458+ Kokkos::deep_copy (surfTiltForce, h_surfTiltForce);
1459+ }
1460+
1461+ void polympo_set_totalMassVertexfVertex_f (MPMesh_ptr p_mpmesh, const int nVertices, double * array){
1462+ // check mpMesh is valid
1463+ checkMPMeshValid (p_mpmesh);
1464+ auto p_mesh = ((polyMPO::MPMesh*)p_mpmesh)->p_mesh ;
1465+
1466+ // check the size
1467+ PMT_ALWAYS_ASSERT (p_mesh->getNumVertices ()==nVertices);
1468+
1469+ // copy the host array to the device
1470+ auto totalMassFVtx = p_mesh->getMeshField <polyMPO::MeshF_TotalMassFVtx>();
1471+ auto h_totalMassFVtx = Kokkos::create_mirror_view (totalMassFVtx);
1472+ for (int i=0 ; i<nVertices; i++)
1473+ h_totalMassFVtx (i,0 ) = array[i];
1474+ Kokkos::deep_copy (totalMassFVtx, h_totalMassFVtx);
1475+ }
1476+
1477+ void polympo_set_oceanStress_f (MPMesh_ptr p_mpmesh, const int nVertices, double * uArray, double * vArray){
1478+ // check mpMesh is valid
1479+ checkMPMeshValid (p_mpmesh);
1480+ auto p_mesh = ((polyMPO::MPMesh*)p_mpmesh)->p_mesh ;
1481+ // check the size
1482+ PMT_ALWAYS_ASSERT (p_mesh->getNumVertices ()==nVertices);
1483+
1484+ // copy the host array to the device
1485+ auto oceanStress = p_mesh->getMeshField <polyMPO::MeshF_OceanStress>();
1486+ auto h_oceanStress = Kokkos::create_mirror_view (oceanStress);
1487+ for (int i=0 ; i<nVertices; i++){
1488+ h_oceanStress (i,0 ) = uArray[i];
1489+ h_oceanStress (i,1 ) = vArray[i];
1490+ }
1491+ Kokkos::deep_copy (oceanStress, h_oceanStress);
1492+ }
1493+
1494+ void polympo_set_oceanStressCoefficient_f (MPMesh_ptr p_mpmesh, const int nVertices, double * array){
1495+ // check mpMesh is valid
1496+ checkMPMeshValid (p_mpmesh);
1497+ auto p_mesh = ((polyMPO::MPMesh*)p_mpmesh)->p_mesh ;
1498+ // check the size
1499+ PMT_ALWAYS_ASSERT (p_mesh->getNumVertices ()==nVertices);
1500+
1501+ // copy the host array to the device
1502+ auto oceanStressCoeff = p_mesh->getMeshField <polyMPO::MeshF_OceanStressCoeff>();
1503+ auto h_oceanStressCoeff = Kokkos::create_mirror_view (oceanStressCoeff);
1504+ for (int i=0 ; i<nVertices; i++)
1505+ h_oceanStressCoeff (i,0 ) = array[i];
1506+
1507+ Kokkos::deep_copy (oceanStressCoeff, h_oceanStressCoeff);
1508+ }
1509+
1510+ void polympo_velocity_grid_solve_f (MPMesh_ptr p_mpmesh){
1511+ // Temporary grid Solve after calculateDivergence
1512+ auto p_mesh = ((polyMPO::MPMesh*)p_mpmesh)->p_mesh ;
1513+ p_mesh->gridSolveGPU ();
1514+ }
13971515
13981516// Advection Calcualtions
13991517void polympo_push_f (MPMesh_ptr p_mpmesh){
0 commit comments