I am trying to interpolate a scalar field between two different meshes in parallel using
transfer function. However, it returns an error. I attached the code here:
test.edp (3.5 KB)
The first transfer trial would return an error,
Exec error : exec assert. Do you know what is going on here? I tracked down to the line where it reports the error, it says:
1312 & assert( kcoe.n == VhLocalOldPrivate.ndof);
1313 & assert( kcoepla.n == VhLocalNewPrivate.ndof);
Thank you in advance!
Can you upload the mesh files?
Thank you for your answer. I have considered that this may be caused by the position of
buildDmesh(), however if I called
buildDmesh before defining
fespace (test.edp (3.4 KB)), the program got stuck after printing “here”. The code would occupy more than 256G of memory and remain unfinished after 1 hour of execution on a node with 128 cores. The meshes I am dealing with are large, but should not take that amount of time just for interpolation. That’s why I feel that it just stuck somewhere. Do you know the possible reason for this issue?
Besides, when I want to
createMat on two different meshes in one piece of code for two equations respectively, is it correct to define it like this?
macro MeshN2O() myN2O//
macro def(i)[i, i#B, i#C, i#D]//
macro init(i)[i, i, i, i]// EOM
createMat(Mesh, NS, Pk2Vector)
macro SolidN2O() myN2OS//
macro def(i)[i, i#B, i#C]// EOM
macro init(i)[i, i, i]// EOM
createMat(Solid, A, Pk1Vector)
It’s impossible to debug further without the meshes.
The size of the mesh file exceeds the limit of the forum. Do you mind if I send you via email?
Can’t you reproduce the issue on smaller meshes? If not, please use a file transfer system like https://wetransfer.com or similar.
Thank you again for helping me. Here is the link to the files for reproducing the problem I met: WeTransfer - Send Large Files & Share Photos Online - Up to 2GB Free. It includes two meshes for interpolation and a data file to be read by code and interpolated between meshes.
Can you reproduce the issue on a smaller mesh?
If you don’t mind me asking, what are you trying to do? Put each platelet
on a mesh vertex or something? Unless you already have done so, you may
want to start with a smaller system just to get some idea of the issues
you will encounter and quickly get initial feedback on the approach or model.
I’m looking eventually at blood coagulation but was going to start
with some barely related systems like two-part “epoxy” systems
with part 1 and 2 diffusing in opposing directions creating a wall between
them in a self-limiting reaction. After playing with it briefly I went
to look at some related topics.
Your code is not consistent.
kcoe appears to be a local function, yet you read inside
sol_files/kcoe.sol which appears to be a global function. Please make your code consistent.
Thank you for your help. Could you suggest me a way to make a global function into a local one along with the partition of the mesh? I have tried
mpiScatter, but it seems not doing exactly what I want. The scattered data does not follow the partition of the mesh.
test.edp (3.7 KB)
You can just do
local = global(array), where
array has been computed using the
restrict keyword alongside the
n2o parameter you used for the mesh partitioning.
Thank you @prj. The problem is resolved! However, in my long production code, in which the movement of the mesh is more complicated, it returns an error when I called
transfer to interpolate the value from the moved platelet mesh to
erreur read mesh 1 negative tet
This error only occurs on some of the mpirank. I am guessing this error is caused by the step in
movemesh where the elements met some problem due to the movement of mesh.
Could you help me to solve this problem?
Do you have a reproducer?
Yes, I made this test code which could reproduce the error. I attached the files that were used in the code. This code is running with 8 cores (the un was saved via 8 processors). The meshes are the same as before. Thank you!
un.zip (3.6 MB)
vf.sol.zip (239.5 KB)
test.edp (2.4 KB)
The context of my problem is like this: I would like to write a coupled process between two meshes. Mesh A will move due to some external force. Along with the movement, the scalar field of mesh A also moved its position. We want to demonstrate such movement on a scalar field on mesh B.
Currently we have thought about two ways to do this:
- Create a new mesh C based on the displacement
[u1n,u2n,u3n] of mesh A using
movemesh. Read value
vf from the undeformed mesh A using
vf_C=vf_A(x-u1n,y-u2n,z-u3n). Then interpolate it to mesh B using
transfer. But it seems that
movemesh may result in bad quality meshes (
erreur read mesh 1 negative tet). The uploaded code is implemented with this approach.
- The second way we come up with is to update the displacement on the scalar field of mesh B using the displacement from mesh A directly:
vf_B =vf_B(x-u1n,y-u2n,z-u3n). But this approach seems introduced relatively large errors.
Could you suggest any alternative on it?
So, the problem is not really related to
transfer(), since in your
test.edp, if you simply add
Solid1 = change(Solid1, fregion = nuTriangle); after the
movemesh(), then you get the same error. Any chance you could regularize your displacement field so that the output mesh is not so distorted?
Thank you so much for your help before. I am now having a new problem with
I am trying to use
transfer function to transfer [P2,P2,P2,P1] values between two different meshes. I attached the code here:
test.edp (2.0 KB)
It will return an error:
Compile error : Invalid array size for vectorial fespace function
the array size must be 4 not 1
Could you please help me take a look?
transfer [P2,P2,P2,P1] values, is it possible to define the values as lines 86-87 in the test code (not using
def), and transfer them directly?
Thank you in advance!
You can only transfer between
fespace with the same number of components. So you need to define something like
fespace SpaceP2Vector(Mesh, P2Vector) and go from
SpaceP2Vector. Then, if you are using a vectorial
fespace, you need to define the macro
def as done prior in your script before calling
Thank you @prj. I modified the code corresponding to what you suggested. This is the updated version of the code, which works well. test.edp (2.0 KB)
But I have a concern about it. Since I need to solve two different problems on two different meshes, I have two different
macro def(i)defFluid(i)// EOM
macro init(i)initFluid(i)// EOM
createMat(Mesh, NS, PkVector)
macro def(i)defSolid(i)// EOM
macro init(i)initSolid(i)// EOM
createMat(Solid, A, Pk)
When I put the macro
macro def(i)[i, i#B, i#C]// EOM after these two things, the code works well. But if I put before these two, then it still has the error:
Invalid array size for vectorial fespace function
the array size must be 4 not 3
I am wondering when I call the macro def after these two
creatMat, will it overwrite the def that is set for two Mat? or it won’t influence the solver afterward?