[petsc-users] Solving a coupled multi-physics problem.

Rahul Samala srahul_05 at yahoo.co.in
Tue Jul 2 06:30:19 CDT 2019

Hello PetSc users,

I request suggestions on how to do a coupled problem, in my case coupling between multiphase flow in porous media and deformation of porous media.I have successfully written and validated the flow code with 3 degrees of freedom (S-saturation, P-pressure, T-Temperature)
which uses SNES solver inside a time loop.  I have to use KSP solve for the deformation problem which has 1 degree of freedom (u-displacement).
For the coupled problem, the flow part now requires the displacement vector and the deformation part requires
the pressure field.

I have written a pseudo-code below. 
My idea is to use the second solution vector (displacement) in FormFunctionLocal belonging to SNES.
Since the DM used by SNES can be used for only one problem, a clone is made to be used for KSP.
Is this approach the correct way to solve this coupled problem.

typedef struct {    
    PetscScalar s; // Saturation
    PetscScalar p; // Pressure
    PetscScalar T; // Temperature
} Field;

typedef struct {    
    PetscScalar u; // Displacement
} Field2;

FormFunctionLocal(DMDALocalInfo *info, Field *sol, Field2 *sol2, Field *f, AppCtx *user)

    DM   da, newda; 
    Vec  sol;
    Vec  sol2;
    SNES  snes;
    KSP   ksp;

    SNESCreate(......, &snes);
    SNESSetDM(snes, da);
    DMClone(da, &newda);
    KSPSetDM(ksp, newda);
    DMCreateGlobalVector(da, &sol);
    DMCreateGlobalVector(newda, &sol2);    // This sol2 of type Field2 is passed to FormFunctionLocal.
    do { // Time loop

Thank you,Rahul.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20190702/1d94f17d/attachment.html>

More information about the petsc-users mailing list