Request for help on DDM method for handling vector fields

Dear Professor and FreeFem users:
I want to use the DDM method to solve three-dimensional electromagnetic field problems. Before solving, some preprocessing is needed, such as adding layers and smoothing (as shown in the program below). However, in the case, it is a scalar field definition. If I want to solve a three component vector field, what approach should I follow to conduct the research? Are there any more cases? This problem has been bo
Addlayers.edp (542 Bytes)
thering me for a long time. I hope to receive your help and provide some ideas. Thank you.

Why would you want to do this yourself instead of using the available tools and macros?

Dear professor, thank you very much for your reply. I haven’t been exposed to this content very much. This is a part of the program that my classmates shared with me, so I didn’t notice that there were ready-made tools available for use as I was studying. Could you please recommend some keywords or links related to this toolbox for me? I would like to further my studies and express my gratitude to you once again

This is just some examples https://www.youtube.com/watch?v=-Aw2O46V2bo or http://joliv.et/FreeFem-tutorial/main.pdf, there is many content available, you should not do this yourself if you are already having trouble for this very basic step.

Dear Professor, thank you very much for your reply and suggestions

Dear professor, thank you very much for your suggestion last time. With your advice, I have successfully calculated the scalar field (temperature field) correctly.
I am currently trying a new problem and encountering issues.
(1) Goal: My goal is to use the ffddm tool to calculate 3D electromagnetic fields using A&phi method. Manuscript Program (DDM_help. edp)
(2) Question: Since A exists in the entire domain Th, while V only exists in ThC, and Th3=trunc (Th, sgm>1), this will lead to a problem where in:
macro Varf (varfName, meshName, VhName), meshName and VhName are not the same. Should I address this issue? If possible, please provide some examples.
Thank you for your help time and time again. Wishing you a happy life!
GetMesh.idp (7.0 KB)
DDM_help.edp (6.6 KB)

Can you share a sequential version of your code that solves your EM problem with the A&phi method, so that we can look into the best way to help you parallelize it using DD ?

thank you very much for your reply. The brief statement of sequential version is as follows ,I would like to know how to use the ffddm tool to implement DDM and parallelism. Looking forward to your reply.
DDM_mine.edp (2.1 KB)

This is my first attempt to refer to some manuals, and I hope to receive your help and advice
try_help.edp (7.3 KB)

Dear teacher, I have studied your video on YouTube, but I still haven’t solved this problem well. Can you give me further advice。

Well, the video gives an introduction to PETSc, but you tried to use ffddm, so there is not much I can do.

Here is your code rewritten using the composite FE spaces formalism (see Composite finite element spaces NEW!) allowing variational forms with coupled variables living on different meshes. The problem is solved with PETSc using a fieldsplit preconditioner, with a simple block preconditioner using hpddm on the A and V blocks.
Are you trying to test specific domain-decomposition methods for your problem, or do you simply want to accelerate your code ?
try_help.edp (5.6 KB)

Thank you for your reply. I previously used matrix block mode, and KK = [[AA, AV],
[VA, VV]];has already solved the task of solving A and V. At present, what I want to do is to use region decomposition and conduct some other research in each subdomain. I used the ffddm method for this idea (new manuscript new1. edp), but in the ffddm tool, there is only one definition for Varfmesh and Vhname. I used the sgm parameter to constrain the region of V, but there have been errors.
new1.edp (7.3 KB)

Thank you for your reply.Professor, I will continue to delve deeper into my studies.