'Failed to attach material parameter' ERROR

9 views
Skip to first unread message

Esra

unread,
Nov 30, 2017, 9:47:28 AM11/30/17
to Salvus

Hi,


I imported topography to the model and I am trying to add 2 layers by using;

sk = Skeleton([sg1, sg2])
m = sk.get_unstructured_mesh()

m.find_side_sets(mode='cartesian')

m.add_dem_3D(x.flatten(), y.flatten(), (zgrid - np.max(zgrid)), z0=bnd_z) #y.flatten makes row vector, z grid oldugu icin flatteni kullanma.
m.apply_dem()


# a mask for the elements in the two layers
top = m.get_element_centroid()[:,2] > bnd_z
bottom = np.logical_not(top)
vpa = vp1 * top + vp1 * bottom
vsa = vs1 * top + vs1 * bottom
rhoa = rho1 * top + rho1 * bottom

m.attach_field('fluid', np.zeros(m.nelem))
m.attach_field('VP', vpa)
m.attach_field('VS', vsa)
m.attach_field('RHO', rhoa)

And when I am trying to run simulation, it gives an error;

Failed to attach material parameter. Original message: You've tried to query a nodal parameter, but none are defined. Perhaps you meant to try an elemental parameter?

Is there anyone who lived the same problem or have an idea about that problem?

Thanks in advance!

Michael Afanasiev

unread,
Nov 30, 2017, 10:45:28 AM11/30/17
to Esra, Salvus
Hello,

It looks like Salvus is expecting the material parameters to be discretized onto the element vertices, but only only value per element was required. To fix the problem, and if the velocities on each element are meant to be constant (seems as if they are), you can modify the lines as follows:

m.attach_field('fluid', np.zeros(m.nelem))
for i in range(m.nodes_per_element):
m.attach_field('VP_{}'.format(i), vpa)
m.attach_field('VS_{}'.format(i), vsa)
m.attach_field('RHO_{}'.format(i), rhoa)

This will attach the correct material parameters to each element vertex. You can alternatively define a continuous parameterization by passing parameter arrays with a length equal to the number of nodes in the mesh.

Let us know if this fixes your issue.

Mike.
> --
> You received this message because you are subscribed to the Google Groups "Salvus" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to salvus+un...@googlegroups.com.
> To post to this group, send email to sal...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/salvus/3125c1c7-d944-4726-b646-07a9549aa32d%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Esra

unread,
Dec 2, 2017, 6:06:57 AM12/2/17
to Salvus
Hi Michael,

Yes it worked, thanks again.

Esra
Reply all
Reply to author
Forward
0 new messages