spring-dashpot boundary

Submitted by JoshuaP on Wed, 02/18/2015 - 11:14

Hey,

I've added a spring-dashpot boundary. Therefor I extended the fix move/mesh to constrain a mesh with a spring-dashpot. Now I need also to output the actual position of the mesh. The calculation of the position is already done inside the liggghts code, but how can I output it to use it in a input script of liggghts. First I thought to look for the servo walls of liggghts, but I would like to have the position directly in the fix move/mesh command and if possible not in the fix mesh/surface/stress. Does someone tried something like this maybe already?

Thanks,
Joshua

ckloss's picture

ckloss | Mon, 02/23/2015 - 12:31

Hi Joshua,

have a look at the compute_vector(), compute_global() functions in LIGGGHTS. All the information which is available within a fix can be output in such a way

Best wishes
Christoph

JoshuaP | Tue, 02/24/2015 - 15:36

Hi Christoph,

thanks for your answer. I added in the fix_move_mesh.cpp


double FixMoveMesh::compute_vector(int n)
{
MeshMoverLinear* mymove;
return mymove->compute_vector(n);
}

and in mesh_mover.cpp:

double MeshMoverLinear::compute_vector(int n)
{
return refpoi[n];
}

I'm able to output variables calculated in the fix_move_mesh, but if I try to access a variable from the mesh_mover I always get segmentation fault during liggghts runs.
I also tried:

MeshMoverLinear* mymove = dynamic_cast< MeshMoverLinear*>(mesh);

but this doesnt help. Someone an idea how to access variables or a compute_vector from another class? I mean I tried almost everything I found on the web and it compiles but gives segmentation fault during liggghts run.

Thanks in advance
Joshua

JoshuaP | Wed, 02/25/2015 - 11:26

Ok I got it and wanna share it.

1. Define a private variable in fix_move_mesh.h
double refpoi[3];
2. add a set function in fix_move_mesh:

void FixMoveMesh::set_refpoi(double *refpoint)
{
refpoi[0] = refpoint[0];
refpoi[1] = refpoint[1];
refpoi[2] = refpoint[2];
}

3. set the reference point each step in the initial integrate
void MeshMoverLinear::initial_integrate(.....)
fix_move_mesh_->set_refpoi(refpoi);

now it is possible to give out the reference point with a compute_vector in FixMoveMesh

double FixMoveMesh::compute_vector(int n){return refpoi[n];}