Skip to content

Commit

Permalink
Merge pull request #22 from UCL-CCS/surrogate
Browse files Browse the repository at this point in the history
Surrogate
  • Loading branch information
mvassaux authored Nov 4, 2020
2 parents cd9dd42 + 4ba7034 commit 03a4c7a
Show file tree
Hide file tree
Showing 13 changed files with 289 additions and 110 deletions.
12 changes: 7 additions & 5 deletions CMakeLists/myriad.CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8)

FIND_PACKAGE(deal.II 8.4.1 QUIET
HINTS ${deal.II_DIR} ${DEAL_II_DIR} ../ ../../ $ENV{DEAL_II_DIR}
HINTS /home/uccamva/opt/dealii-9.0.0/ ${deal.II_DIR} ${DEAL_II_DIR} ../ ../../ $ENV{DEAL_II_DIR}
)
IF(NOT ${deal.II_FOUND})
MESSAGE(FATAL_ERROR "\n"
Expand All @@ -26,17 +26,19 @@ DEAL_II_SETUP_TARGET(strain_md)

## Include LAMMPS sources repository
INCLUDE_DIRECTORIES(
/shared/ucl/apps/lammps/16Mar18/USERINTEL/intel-2018/lammps-16Mar18/src/
/home/uccamva/sources/lammps-17Nov16/src/
/home/uccamva/.conda/envs/surrogate/include/python3.8/
)

## Include BOOST sources repository
#FIND_PACKAGE( Boost 1.58 COMPONENTS filesystem mpi REQUIRED )
#INCLUDE_DIRECTORIES( ${Boost_INCLUDE_DIR} )

## Include LAMMPS library shared .so (or static .a)
TARGET_LINK_LIBRARIES(dealammps ~/.local/lib64/liblammps.so)
TARGET_LINK_LIBRARIES(init_material ~/.local/lib64/liblammps.so)
TARGET_LINK_LIBRARIES(strain_md ~/.local/lib64/liblammps.so)
TARGET_LINK_LIBRARIES(dealammps /home/uccamva/sources/lammps-17Nov16/src/liblammps.so)
TARGET_LINK_LIBRARIES(dealammps /home/uccamva/.conda/envs/surrogate/lib/libpython3.8.so)
TARGET_LINK_LIBRARIES(init_material /home/uccamva/sources/lammps-17Nov16/src/liblammps.so)
TARGET_LINK_LIBRARIES(strain_md /home/uccamva/sources/lammps-17Nov16/src/liblammps.so)

TARGET_LINK_LIBRARIES(dealammps LINK_PUBLIC ${Boost_LIBRARIES})
TARGET_LINK_LIBRARIES(init_material LINK_PUBLIC ${Boost_LIBRARIES})
Expand Down
8 changes: 4 additions & 4 deletions dealammps.cc
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ namespace HMM
Tensor<1,dim> cg_dir;
boost::property_tree::ptree input_config;

bool activate_md_update;
int stress_compute_method;
bool approx_md_with_hookes_law;
bool use_pjm_scheduler;

Expand Down Expand Up @@ -236,7 +236,7 @@ namespace HMM
quadrature_formula = input_config.get<int>("continuum mesh.quadrature formula");

// Scale-bridging parameters
activate_md_update = input_config.get<bool>("scale-bridging.activate md update");
stress_compute_method = input_config.get<int>("scale-bridging.stress computation method");
approx_md_with_hookes_law =input_config.get<bool>("scale-bridging.approximate md with hookes law");
use_pjm_scheduler = input_config.get<bool>("scale-bridging.use pjm scheduler");

Expand Down Expand Up @@ -294,7 +294,7 @@ namespace HMM

// Print a recap of all the parameters...
hcout << "Parameters listing:" << std::endl;
hcout << " - Activate MD updates (1 is true, 0 is false): "<< activate_md_update << std::endl;
hcout << " - Method to compute local stresses (0 - LAMMPS, 1 - Hooke's law, 2 - ML surrogate model): "<< stress_compute_method << std::endl;
hcout << " - Approximate MD sims with hookes law (1 is true, 0 is false): "<< approx_md_with_hookes_law << std::endl;
hcout << " - Use Pilot Job Manager to schedule MD jobs: "<< use_pjm_scheduler << std::endl;
hcout << " - FE timestep duration: "<< fe_timestep_length << std::endl;
Expand Down Expand Up @@ -523,7 +523,7 @@ namespace HMM
macrostatelocin, macrostatelocout,
macrostatelocres, macrologloc,
freq_checkpoint, freq_output_visu, freq_output_lhist, freq_output_lbcforce,
activate_md_update, mdtype, cg_dir,
stress_compute_method, mdtype, cg_dir,
twod_mesh_file, extrude_length, extrude_points,
input_config, approx_md_with_hookes_law);

Expand Down
8 changes: 4 additions & 4 deletions examples/streched_polyhedron/inputs.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"strain rate": 0.002
},
"scale-bridging":{
"activate md update": 1,
"stress computation method": 0,
"approximate md with hookes law": 0,
"use pjm scheduler": 0
},
Expand All @@ -30,7 +30,7 @@
"md":{
"min quadrature strain norm": 1.0e-10
},
"clustering":{
"clustering":{
"spline points": 10,
"min steps": 5000,
"diff threshold": 0.000001,
Expand All @@ -56,14 +56,14 @@
},
"computational resources":{
"machine cores per node": 24,
"maximum number of cores for FEM simulation": 1,
"maximum number of cores for FEM simulation": 1,
"minimum number of cores for MD simulation": 1
},
"output data":{
"checkpoint frequency": 1,
"visualisation output frequency": 1,
"analytics output frequency": 1,
"loaded boundary force output frequency": 1,
"loaded boundary force output frequency": 1,
"homogenization output frequency": 1000
},
"directory structure":{
Expand Down
9 changes: 6 additions & 3 deletions headers/FE.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ namespace HMM
SymmetricTensor<2,dim> upd_strain;
SymmetricTensor<2,dim> newton_strain;
MatHistPredict::Strain6D hist_strain;
bool to_be_updated;
bool to_be_updated_with_md;

// Characteristics
unsigned int qpid;
Expand Down Expand Up @@ -233,7 +233,7 @@ namespace HMM

void init (int sstp, double tlength, std::string mslocin, std::string mslocout,
std::string mslocres, std::string mlogloc, int fchpt, int fovis, int folhis, int folbcf,
bool actmdup, std::vector<std::string> mdt, Tensor<1,dim> cgd,
int stress_method, std::vector<std::string> mdt, Tensor<1,dim> cgd,
std::string twodmfile, double extrudel, int extrudep,
boost::property_tree::ptree inconfig, bool hookeslaw);
void beginstep (int tstp, double ptime);
Expand Down Expand Up @@ -272,6 +272,9 @@ namespace HMM
void gather_qp_update_list(ScaleBridgingData &scale_bridging_data);
template <typename T>
std::vector<T> gather_vector(std::vector<T> local_vector);
SymmetricTensor<2,dim> compute_stress_with_surrogate(SymmetricTensor<2,dim> old_strain,
SymmetricTensor<2,dim> new_strain,
SymmetricTensor<2,dim> old_stress);
void update_stress_quadrature_point_history
(const Vector<double>& displacement_update, ScaleBridgingData scale_bridging_data);
void clean_transfer();
Expand Down Expand Up @@ -360,7 +363,7 @@ namespace HMM
int freq_output_lhist;
int freq_output_lbcforce;

bool activate_md_update;
int stress_compute_method;

std::string twod_mesh_file;
double extrude_length;
Expand Down
Loading

0 comments on commit 03a4c7a

Please sign in to comment.