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

General wall distance functions #1171

Open
wants to merge 25 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
ebff750
start wall distance function solve
AdelekeBankole Mar 6, 2023
572d6c6
add dirichlet bc on cylinder walls
AdelekeBankole Mar 6, 2023
a70ad90
create CeedOperator for distance function
AdelekeBankole Mar 7, 2023
ca77740
remove ksp
AdelekeBankole Mar 13, 2023
574bb8b
update number of components
AdelekeBankole Mar 13, 2023
bc264f3
update solver
AdelekeBankole Mar 13, 2023
4ee4556
update distance function solver
AdelekeBankole Mar 13, 2023
0710d6f
add field to dmDist
AdelekeBankole Mar 14, 2023
12daea7
remove solver from setupts.c
AdelekeBankole Mar 14, 2023
659a618
create source file for distance function
AdelekeBankole Mar 14, 2023
9eda29b
create qfunction file
AdelekeBankole Mar 14, 2023
dbd2b4a
update distance function struct
AdelekeBankole Mar 15, 2023
00ea50e
update qfunction file
AdelekeBankole Mar 15, 2023
55e1d1e
create and add qfunction fields
AdelekeBankole Mar 15, 2023
1638abf
set up snes solve
AdelekeBankole Mar 16, 2023
210549a
update on elem restriction and basis
AdelekeBankole Mar 17, 2023
afba689
update solver with CeedOperatorApply
AdelekeBankole Mar 18, 2023
cf684c4
clean up some calls
AdelekeBankole Mar 21, 2023
0594872
update Qfunction
AdelekeBankole Mar 21, 2023
3e8ed0e
update qfunctions
AdelekeBankole Mar 27, 2023
90908be
fix vec type mismatch
AdelekeBankole Mar 28, 2023
c22135f
create MatShell
AdelekeBankole Apr 3, 2023
fad9282
substract mass matrix from Qfunction
AdelekeBankole Apr 7, 2023
770ce4c
add mass matrix Qfunction
AdelekeBankole Apr 7, 2023
e6bdd5d
update and create mass qfunction
AdelekeBankole Apr 10, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions examples/fluids/navierstokes.h
Expand Up @@ -140,6 +140,13 @@ struct CeedData_private {
qf_apply_outflow_jacobian, qf_apply_freestream, qf_apply_freestream_jacobian;
};

// Distance functions
struct Distance_private {
DM dm;
SNES snesDist;
CeedOperator op_distance_function;
};

typedef struct {
DM dm;
PetscSF sf; // For communicating child data to parents
Expand Down
5 changes: 5 additions & 0 deletions examples/fluids/src/setupdm.c
Expand Up @@ -71,6 +71,11 @@ PetscErrorCode SetUpDM(DM dm, ProblemData *problem, PetscInt degree, SimpleBC bc
PetscCall(DMAddBoundary(dm, DM_BC_ESSENTIAL, "slipz", label, bc->num_slip[2], bc->slips[2], 0, 1, comps, (void (*)(void))NULL, NULL,
problem->bc_ctx, NULL));
}
// Set dirichlet boundary condition on cylinder walls
if (bc->num_wall > 0) {
PetscCall(DMAddBoundary(dm, DM_BC_ESSENTIAL, "cylinder_wall", label, bc->num_wall, bc->walls, 0, 1, bc->wall_comps, (void (*)(void))problem->bc,
NULL, problem->bc_ctx, NULL));
}
AdelekeBankole marked this conversation as resolved.
Show resolved Hide resolved
{
PetscBool use_strongstg = PETSC_FALSE;
PetscCall(PetscOptionsGetBool(NULL, NULL, "-stg_strong", &use_strongstg, NULL));
Expand Down
23 changes: 23 additions & 0 deletions examples/fluids/src/setupts.c
Expand Up @@ -179,6 +179,29 @@ static PetscErrorCode Surface_Forces_NS(DM dm, Vec G_loc, PetscInt num_walls, co
PetscFunctionReturn(0);
}

// General distance functions
static PetscErrorCode Distance_Function_NS(DM dm, User user) {
Vec *Dist_loc;
PetscInt dim = 3;
PetscInt num_wall = user->app_ctx->wall_forces.num_wall;
DM dmDist;
SNES snesDist;
MPI_Comm comm;

PetscFunctionBeginUser;
PetscBool distance_snes_monitor = PETSC_FALSE;
PetscCall(PetscOptionsHasName(NULL, NULL, "-distance_snes_monitor", &distance_snes_monitor));
PetscCall(PetscObjectGetComm((PetscObject)dm, &comm));
PetscCall(SNESCreate(PETSC_COMM_WORLD, &snesDist));
PetscObjectSetOptionsPrefix((PetscObject)snesDist, "distance_");
PetscCall(PetscMalloc1(dim * num_wall, &Dist_loc));
AdelekeBankole marked this conversation as resolved.
Show resolved Hide resolved
PetscCall(DMClone(dm, &dmDist));
AdelekeBankole marked this conversation as resolved.
Show resolved Hide resolved
PetscCall(DMCreateLocalVector(dmDist, Dist_loc));

PetscCall(PetscFree(Dist_loc));
PetscFunctionReturn(0);
}

// Implicit time-stepper function setup
PetscErrorCode IFunction_NS(TS ts, PetscReal t, Vec Q, Vec Q_dot, Vec G, void *user_data) {
User user = *(User *)user_data;
Expand Down