Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Pfem Melting application #9324

Closed
wants to merge 57 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
e90cb14
new element
juliobarna Mar 11, 2021
8cff0ff
removing warnings
juliobarna Mar 12, 2021
311a8fd
changes: several json has been added in order to consider differents …
juliobarna Mar 19, 2021
4ff0f65
adding a new element and new json files
juliobarna Mar 29, 2021
f023aba
adding heat source
juliobarna Mar 29, 2021
ccfad12
organized element and functions
juliobarna Apr 8, 2021
22a8689
forcing dependencies
Sep 19, 2021
050acb8
windows compilation
Sep 19, 2021
e83e92f
missing dependencies
jginternational Sep 24, 2021
22ef02f
solver type
jginternational Sep 24, 2021
822d634
Merge branch 'master' into meltingapplication
jginternational Sep 24, 2021
26c7a15
Changes needed to build windows
jginternational Sep 24, 2021
631fd2c
compilation warning
jginternational Sep 24, 2021
3dfbeb4
new updates
juliobarna Oct 5, 2021
1af6904
new updates
juliobarna Oct 5, 2021
f590be2
Delete applications/PfemMeltingApplication1 directory
juliobarna Oct 5, 2021
aa36f5c
new example
juliobarna Oct 8, 2021
2f876d4
erasing pfem2 application into pfemmelting
juliobarna Oct 14, 2021
df01f0c
fixing Windows compilation
Oct 27, 2021
e3e9e20
Merge branch 'master' into meltingapplication
Nov 2, 2021
d9f1c8a
using the lumped mass matrix instead of the full one due to numerical…
juliobarna Nov 3, 2021
03f68ad
Merge branch 'meltingapplication' of https://github.com/KratosMultiph…
juliobarna Nov 3, 2021
70bc7cd
new
juliobarna Nov 3, 2021
e4b9613
basic example running. Empty laser process is created.
Nov 3, 2021
0c9a415
Merge branch 'meltingapplication' of https://github.com/KratosMultiph…
Nov 3, 2021
527706a
example with only the required model parts
juliobarna Nov 9, 2021
81e5090
without properties in the mdpa file
juliobarna Nov 10, 2021
999008b
commenting some operations with model parts
juliobarna Nov 10, 2021
0e4d491
windows compilation fixed
Nov 10, 2021
cd0daa9
Merge branch 'master' into meltingapplication
jginternational Nov 11, 2021
29fcdfc
Laser utility added
juliobarna Nov 12, 2021
e28ac88
Merge branch 'meltingapplication' of https://github.com/KratosMultiph…
juliobarna Nov 12, 2021
da2e602
Merge branch 'meltingapplication' of https://github.com/KratosMultiph…
jginternational Nov 14, 2021
0a3d181
Some bugfixes
Nov 17, 2021
dfbc8ec
fixes
Nov 30, 2021
f55ef79
adding ambient temperature and mesh size
juliobarna Nov 30, 2021
0d456ce
with variable viscosity
juliobarna Nov 30, 2021
3fbc901
more adaptations. Adding values to json
Nov 30, 2021
18cd7ee
example new
juliobarna Nov 30, 2021
95368d9
adding new model part
juliobarna Nov 30, 2021
5593028
Merge branch 'meltingapplication' of https://github.com/KratosMultiph…
juliobarna Nov 30, 2021
b64ada1
reading laser file and improving the example
juliobarna Dec 16, 2021
2de1c39
Merge branch 'meltingapplication' of https://github.com/KratosMultiph…
jginternational Dec 16, 2021
2ea2451
Merge branch 'master' into meltingapplication
jginternational Dec 16, 2021
0e95472
missing space
jginternational Dec 16, 2021
21df0ea
flat laser working
Feb 1, 2022
3021255
minor changes
juliobarna Feb 2, 2022
5248a23
saving memory and improving laser process
juliobarna Feb 8, 2022
9a489f9
including normals in the faceheatflux
juliobarna Feb 21, 2022
15084dd
updates
juliobarna Feb 21, 2022
276680d
erasing elements when j>0
juliobarna Mar 15, 2022
768846f
cleaning the outputs
juliobarna Mar 22, 2022
41c2cf9
cleaning the outputs
juliobarna Mar 22, 2022
1feee7e
solver without remesh
juliobarna Apr 4, 2022
8fab508
adding solver without remesh
juliobarna Apr 4, 2022
da176b0
including time measurements
juliobarna Apr 20, 2022
722c773
adding a hypoelastic element
juliobarna Jun 30, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ namespace Kratos
}
}


//Some auxilary definitions
BoundedMatrix<double,TNumNodes, TNumNodes> aux1 = ZeroMatrix(TNumNodes, TNumNodes); //terms multiplying dphi/dt
BoundedMatrix<double,TNumNodes, TNumNodes> aux2 = ZeroMatrix(TNumNodes, TNumNodes); //terms multiplying phi
Expand All @@ -129,20 +130,21 @@ namespace Kratos
for(unsigned int k=0; k<TDim; k++)
vel_gauss[k] += N[i]*(Variables.v[i][k]*Variables.theta + Variables.vold[i][k]*(1.0-Variables.theta));
}

const double norm_vel = norm_2(vel_gauss);
array_1d<double, TNumNodes > a_dot_grad = prod(DN_DX, vel_gauss);

const double tau = this->CalculateTau(Variables,norm_vel,h);

//terms multiplying dphi/dt (aux1)
noalias(aux1) += (1.0+tau*Variables.beta*Variables.div_v)*outer_prod(N, N);
noalias(aux1) += (1.0+tau*Variables.beta*Variables.div_v)* 0.25 * IdentityMatrix(4, 4); //outer_prod(N, N); //0.25 * IdentityMatrix(4, 4);
noalias(aux1) += tau*outer_prod(a_dot_grad, N);

//terms which multiply the gradient of phi
noalias(aux2) += (1.0+tau*Variables.beta*Variables.div_v)*outer_prod(N, a_dot_grad);
noalias(aux2) += tau*outer_prod(a_dot_grad, a_dot_grad);
}

}
//adding the second and third term in the formulation
noalias(rLeftHandSideMatrix) = (Variables.dt_inv*Variables.density*Variables.specific_heat + Variables.theta*Variables.beta*Variables.div_v)*aux1;
noalias(rRightHandSideVector) = (Variables.dt_inv*Variables.density*Variables.specific_heat - (1.0-Variables.theta)*Variables.beta*Variables.div_v)*prod(aux1,Variables.phi_old);
Expand Down Expand Up @@ -261,13 +263,17 @@ namespace Kratos
rVariables.v[i] = GetGeometry()[i].FastGetSolutionStepValue(rVelocityVar);
rVariables.vold[i] = GetGeometry()[i].FastGetSolutionStepValue(rVelocityVar,1);
//active_convection=true;



}

if (IsDefinedMeshVelocityVariable)
{
const Variable<array_1d<double, 3 > >& rMeshVelocityVar = my_settings->GetMeshVelocityVariable();
rVariables.v[i] -= GetGeometry()[i].FastGetSolutionStepValue(rMeshVelocityVar);
rVariables.vold[i] -= GetGeometry()[i].FastGetSolutionStepValue(rMeshVelocityVar,1);

//active_convection=true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ namespace Kratos
*/
template< unsigned int TDim,
unsigned int TNumNodes = TDim + 1 >
class VMS : public Element
class KRATOS_API(FLUID_DYNAMICS_APPLICATION) VMS : public Element
{
public:
///@name Type Definitions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ namespace Kratos {
array_1d<double, 3 > & OldVelocity = (itNode)->FastGetSolutionStepValue(VELOCITY, 1);

noalias(itNode->FastGetSolutionStepValue(MESH_VELOCITY)) = itNode->FastGetSolutionStepValue(VELOCITY);
UpdateDisplacement(CurrentDisplacement, OldDisplacement, OldVelocity, OldAcceleration, CurrentAcceleration);
//UpdateDisplacement(CurrentDisplacement, OldDisplacement, OldVelocity, OldAcceleration, CurrentAcceleration);
}
else
{
Expand Down Expand Up @@ -407,7 +407,7 @@ namespace Kratos {
if((itNode)->FastGetSolutionStepValue(IS_LAGRANGIAN_INLET) < 1e-15)
{
noalias(itNode->FastGetSolutionStepValue(MESH_VELOCITY)) = itNode->FastGetSolutionStepValue(VELOCITY);
UpdateDisplacement(CurrentDisplacement, OldDisplacement, OldVelocity, OldAcceleration, CurrentAcceleration);
//UpdateDisplacement(CurrentDisplacement, OldDisplacement, OldVelocity, OldAcceleration, CurrentAcceleration);
}
else
{
Expand Down
1 change: 1 addition & 0 deletions applications/MeshingApplication/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ if(${USE_TETGEN_NONFREE_TPL} MATCHES ON)
include_directories(${TETGEN_INCLUDE})
add_library(tetgen STATIC ${TETGEN_INCLUDE}/tetgen.cxx ${TETGEN_INCLUDE}/predicates.cxx)
target_compile_definitions(tetgen PRIVATE -DTETLIBRARY)
add_definitions(-DUSE_TETGEN_NONFREE_TPL)
endif(${USE_TETGEN_NONFREE_TPL} MATCHES ON)

## generate variables with the sources
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include "external_includes/tetgen_cdt.h"
#else
#define REAL double
#endif
#endif

#if USE_TRIANGLE_NONFREE_TPL
#include "external_includes/trigen_pfem_refine.h"
Expand All @@ -37,7 +37,7 @@
#include "external_includes/trigen_glass_forming.h"
#include "external_includes/trigen_droplet_refine.h"
#include "external_includes/trigen_cdt.h"
#endif
#endif

namespace Kratos
{
Expand Down Expand Up @@ -200,9 +200,11 @@ void TriRegenerateMeshVMS(TriGenPFEMModelerVMS& Mesher, char* ElementName, char*

void AddMeshersToPython(pybind11::module& m)
{


#pragma message "A ****************************************************************************************"
#ifdef USE_TETGEN_NONFREE_TPL
// Class that allows 3D adaptive remeshing (inserting and erasing nodes)
#pragma message "B ****************************************************************************************"
py::class_<TetGenPfemModeler, TetGenPfemModeler::Pointer >(m, "TetGenPfemModeler")
.def(py::init< >())
.def("ReGenerateMesh",TetRegenerateMesh)
Expand All @@ -218,7 +220,7 @@ void AddMeshersToPython(pybind11::module& m)
.def(py::init< >())
.def("ReGenerateMesh",TetRegenerateMeshContact)
;

py::class_<TetGenCDT, TetGenCDT::Pointer >(m, "TetGenCDT")
.def(py::init< >())
.def("GenerateCDT",GenerateCDT)
Expand All @@ -229,7 +231,7 @@ void AddMeshersToPython(pybind11::module& m)
.def("ReGenerateMesh",&TetGenPfemModelerVms::ReGenerateMesh)
;
#endif

#if USE_TRIANGLE_NONFREE_TPL
// Class that allows 2D adaptive remeshing (inserting and erasing nodes)
py::class_<TriGenPFEMModeler, TriGenPFEMModeler::Pointer >(m, "TriGenPFEMModeler")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ namespace Kratos
PointVector res(max_results);
DistanceVector res_distances(max_results);
Node<3> work_point(0,0.0,0.0,0.0);
KRATOS_WATCH(h_factor)
//KRATOS_WATCH(h_factor)
//if the remove_node switch is activated, we check if the nodes got too close
if (rem_nodes==true)
{
Expand Down Expand Up @@ -238,7 +238,7 @@ namespace Kratos


double first_part_time = auxiliary.elapsed();
std::cout << "mesh generation time = " << first_part_time << std::endl;
//std::cout << "mesh generation time = " << first_part_time << std::endl;

//generate Kratos Tetrahedra3D4
int el_number = out.numberoftetrahedra;
Expand Down Expand Up @@ -406,7 +406,7 @@ namespace Kratos
}

}
std::cout << "time for passing alpha shape" << alpha_shape_time.elapsed() << std::endl;
//std::cout << "time for passing alpha shape" << alpha_shape_time.elapsed() << std::endl;

//freeing unnecessary memory
in.deinitialize();
Expand All @@ -426,7 +426,7 @@ namespace Kratos
in2.pointlist[base+1] = (nodes_begin + i)->Y();
in2.pointlist[base+2] = (nodes_begin + i)->Z();
}
std::cout << "qui" << std::endl;
//std::cout << "qui" << std::endl;
in2.numberoftetrahedra = number_of_preserved_elems;
in2.tetrahedronlist = new int[in2.numberoftetrahedra * 4];
in2.tetrahedronvolumelist = new double[in2.numberoftetrahedra];
Expand Down Expand Up @@ -516,7 +516,7 @@ namespace Kratos

//q - creates quality mesh, with the default radius-edge ratio set to 2.0

std::cout << "mesh recreation time" << mesh_recreation_time.elapsed() << std::endl;
//std::cout << "mesh recreation time" << mesh_recreation_time.elapsed() << std::endl;


//PAVEL
Expand Down Expand Up @@ -577,7 +577,7 @@ namespace Kratos
}
}

std::cout << "During refinement we added " << outnew.numberofpoints-n_points_before_refinement<< "nodes " <<std::endl;
//std::cout << "During refinement we added " << outnew.numberofpoints-n_points_before_refinement<< "nodes " <<std::endl;


bucket_size = 50;
Expand Down Expand Up @@ -758,7 +758,7 @@ ModelPart::NodesContainerType& ModelNodes = ThisModelPart.Nodes();
(ThisModelPart.Elements()).push_back(p_element);

}
std::cout << "time for adding elems" << adding_elems.elapsed() << std::endl;;
//std::cout << "time for adding elems" << adding_elems.elapsed() << std::endl;;
ThisModelPart.Elements().Sort();

boost::timer adding_neighb;
Expand All @@ -782,7 +782,7 @@ ModelPart::NodesContainerType& ModelNodes = ThisModelPart.Nodes();
neighb(i) = Element::WeakPointer();
}
}
std::cout << "time for adding neigbours" << adding_neighb.elapsed() << std::endl;;
//std::cout << "time for adding neigbours" << adding_neighb.elapsed() << std::endl;;



Expand All @@ -797,7 +797,7 @@ ModelPart::NodesContainerType& ModelNodes = ThisModelPart.Nodes();
in->FastGetSolutionStepValue(IS_BOUNDARY) = 0;
}

std::cout << "reset the boundary flag" << adding_neighb.elapsed() << std::endl;;
//std::cout << "reset the boundary flag" << adding_neighb.elapsed() << std::endl;;
//***********************************************************************************
//***********************************************************************************
boost::timer adding_faces;
Expand Down Expand Up @@ -844,7 +844,7 @@ ModelPart::NodesContainerType& ModelNodes = ThisModelPart.Nodes();
}
outnew.deinitialize();
outnew.initialize();
std::cout << "time for adding faces" << adding_faces.elapsed() << std::endl;;
//std::cout << "time for adding faces" << adding_faces.elapsed() << std::endl;;



Expand All @@ -870,7 +870,7 @@ ModelPart::NodesContainerType& ModelNodes = ThisModelPart.Nodes();


double second_part_time = auxiliary.elapsed();
std::cout << "second part time = " << second_part_time - first_part_time << std::endl;
//std::cout << "second part time = " << second_part_time - first_part_time << std::endl;


KRATOS_CATCH("")
Expand Down
Loading