saveVTK and 3D visiulization and dirichlet boundary conditions

Asked by Doug White

Hi,

In your tutorials you talk about saving the data to VTK files or other formats which can be used with other programs for 3D visualization. However when I run this function I get an error:

ArgumentError: Python argument types in Data.saveVTK(Data, str) did not match C++ signature: saveVTK(class escript::Data {lvalue}, class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > fileName)

Is there any way around this or am I just doing it incorrectly? Is there another way to visualize the data in 3D? Examples are mentioned in this, but I can't seem to find them in my installation package.

Also, is there a complimentary function to whereZero which allows you to create dirichlet boundary conditions where x is equal to any arbitrary number? That way I could for set all the boundary conditions at the edges of my brick to be the same.

I really appreciate the help and apologize for all of the questions.

Thanks,
Doug

Question information

Language:
English Edit question
Status:
Solved
For:
esys-escript Edit question
Assignee:
No assignee Edit question
Solved by:
Doug White
Solved:
Last query:
Last reply:
Revision history for this message
Lutz Gross (l-gross) said :
#1

Question one: From the error message I would guess that your call of saveVTK is not correct: The call has the form

    saveVTK("myvtk.vtu", a=d1, b=d2)

if you want to write the escript object d1 and d2.

We are pretty much relying on the VTK format which can be read by a variety of packages including mayavi (which is part of some Linux distribution), Pareview and VisIt. You can also use saveDataCSV, see http://esys.esscc.uq.edu.au/esys13/nightly/user/html/node34.html, which produces a "data cloud".

To set the the constant value (e.g. 1) one the bottom face of a brick you can use:

pde=LinearPDE(domain)
x=domain.getX()
pde.setValue(q=whereZero(x[2]-inf(x[2])), r= 1)

to set 1 on bottom and 2 on the top face you can use

x=domain.getX()
m_top=whereZero(x[2]-sup(x[2]))
m_bottom=whereZero(x[2]-inf(x[2]))
pde.setValue(q=m_top+m)bottom, r= m_top * 2 + m_bottom * 1)

There is also the option of tagging:

m=Scalar(0., ContinuousFunction(domain))
v=Scalar(0., ContinuousFunction(domain))
m.setTaggedValue("bottom", 1)
m.setTaggedValue("top", 1)
v.setTaggedValue("bottom", 1.)
v.setTaggedValue("top", 2.)
pde.setValue(q=m, r= v)

Revision history for this message
Doug White (dewtennis222) said :
#2

I think I solved my problem. I was caling u.saveVTK instead of saveVTK.