Defining multiple local meshes using buildDmesh

Hello all,

I am using the macro_ddm.idp to use buildDmesh and createMat with macro def(i) [i, i#B, i#C] // to solve the 3D elasticity equation in parallel using PETSc. I also need to solve a 1D and 2D varf in the same parallel script - how can I solve the varf of different dimension using the same local mesh, or how can I define another local mesh with different dimension (ex. def(i) i// ) using buildDmesh?

Thank you.

Are your 1D and 2D meshes somehow related to the 3D mesh?

Yes - they use the same 3D global mesh.

Could you please share a minimalist sequential script with your various global meshes so that it’s better to see how they interact one with another?

I’ve attached a simplified sequential version (ie. no mesh decomposition). The solver doesn’t work in this sequential case, but this is just so you can see what I intend to do/solve.

Example.edp (6.0 KB)

I just see a single 3D mesh Omega in this script, is this alright?

Yes - that is the single domain over which the integrals in both varfs are applied.

But both varf are defined on Omega, your single 3D mesh. You said initially that you have “1D and 2D varf”, but I don’t see any varf using either a mesh or meshL.

If the “only” issue is mixing vectorial and scalar finite element spaces, you can just do the following.

load "PETSc"
macro dimension()3//
include "macro_ddm.idp"

mesh3 Omega = cube(10, 10, 10);

buildDmesh(Omega);
Mat A, B;
{
    macro def(i)[i, i#B, i#C]//
    macro init(i)[i, i, i]//
    createMat(Omega, A, [P2, P2, P2]);
}
{
    macro def(i)i// not mandatory
    macro init(i)i// not mandatory
    createMat(Omega, B, P1);
}

This is what I was trying to explain - thank you! My apologies for doing such a poor job at explaining, but this is exactly what I was trying to figure out.

Thank you again!

OK, good then! No problem at all :smile:

Hi Pierre!

How about solving in the same parallel script a problem in one mesh and another in a part of this mesh. For example, if you consider a 2D mesh and then solve a problem into a 1D mesh extract from this 2D mesh.

Not a problem at all, in fact, that’s exactly what’s done in, e.g., FreeFem-sources/examples/hpddm/helmholtz-coupled-2d-PETSc-complex.edp at develop · FreeFem/FreeFem-sources · GitHub.