Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
VirtualFluids
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
iRMB
VirtualFluids
Commits
2aa7d947
Commit
2aa7d947
authored
3 years ago
by
kutscher
Browse files
Options
Downloads
Patches
Plain Diff
add first LIGGGHTS test
parent
d54550dc
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!171
Newest Update
,
!83
Fix MPICommunicator
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
apps/cpu/LiggghtsApp/LiggghtsApp.cpp
+59
-2
59 additions, 2 deletions
apps/cpu/LiggghtsApp/LiggghtsApp.cpp
with
59 additions
and
2 deletions
apps/cpu/LiggghtsApp/LiggghtsApp.cpp
+
59
−
2
View file @
2aa7d947
...
...
@@ -5,6 +5,10 @@
#include
"VirtualFluids.h"
#include
"lammps.h"
#include
"input.h"
#include
"atom.h"
#include
"modify.h"
#include
"fix_lb_coupling_onetoone.h"
using
namespace
std
;
...
...
@@ -347,8 +351,61 @@ int main(int argc, char *argv[])
// create LAMMPS instance
lmp
=
new
LAMMPS_NS
::
LAMMPS
(
lmpargc
,
(
char
**
)
lmpargv
,
MPI_COMM_WORLD
);
// output numerical version string
//std::cout << "LAMMPS version ID: " << lmp->num_ver << std::endl;
lmp
->
input
->
file
(
"in.chute_wear"
);
//lmp->input->one("run 1");
//# Try extracting a global value
// print("")
// print("Attempting to get the number of atoms in simulation")
// numAtoms = lmp.extract_global("natoms", 0)
// print("natoms =", numAtoms)
// # Try extracting atom's positions
// print("")
// print("Attempting to get the atom's positions")
// pos = lmp.extract_atom("x",3)
// for k in range(0,numAtoms):
// print("Pos[%i] = [%f, %f, %f]" % (k, pos[k][0], pos[k][1], pos[k][2]))
LAMMPS_NS
::
FixLbCouplingOnetoone
*
couplingFix
=
dynamic_cast
<
LAMMPS_NS
::
FixLbCouplingOnetoone
*>
(
lmp
->
modify
->
find_fix_style
(
"couple/lb/onetoone"
,
0
));
cout
<<
"test1
\n
"
;
//double **t_liggghts = couplingFix->get_torque_ptr();
cout
<<
"test2
\n
"
;
lmp
->
input
->
one
(
"run 9 upto"
);
for
(
int
step
=
0
;
step
<
3
;
step
++
)
{
int
numAtoms
=
lmp
->
atom
->
natoms
;
//double** pos = (double**)lmp->atom->extract("x");
double
**
pos
=
lmp
->
atom
->
x
;
//double* forceX = lmp->atom->fx;
for
(
int
i
=
0
;
i
<
numAtoms
;
i
++
)
{
double
**
f_liggghts
=
couplingFix
->
get_force_ptr
();
double
**
force
=
lmp
->
atom
->
f
;
cout
<<
"Pos["
<<
i
<<
"] = ["
<<
pos
[
i
][
0
]
<<
", "
<<
pos
[
i
][
1
]
<<
", "
<<
pos
[
i
][
2
]
<<
"]
\n
"
;
cout
<<
"Force["
<<
i
<<
"] = ["
<<
f_liggghts
[
i
][
0
]
<<
", "
<<
f_liggghts
[
i
][
1
]
<<
", "
<<
f_liggghts
[
i
][
2
]
<<
"]
\n
"
;
f_liggghts
[
i
][
2
]
+=
500
;
cout
<<
"Force["
<<
i
<<
"] = ["
<<
force
[
i
][
0
]
<<
", "
<<
force
[
i
][
1
]
<<
", "
<<
force
[
i
][
2
]
<<
"]
\n
"
;
}
couplingFix
->
comm_force_torque
();
lmp
->
input
->
one
(
"run 10"
);
}
// delete LAMMPS instance
delete
lmp
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment