diff --git a/applications/FSIapplication/custom_python/add_convergence_accelerators_to_python.cpp b/applications/FSIapplication/custom_python/add_convergence_accelerators_to_python.cpp index 5aafb7a67a18..50c33082f41c 100644 --- a/applications/FSIapplication/custom_python/add_convergence_accelerators_to_python.cpp +++ b/applications/FSIapplication/custom_python/add_convergence_accelerators_to_python.cpp @@ -47,6 +47,7 @@ void AddConvergenceAcceleratorsToPython() // Aitken convergence accelerator class_< AitkenConvergenceAccelerator , bases , boost::noncopyable > ("AitkenConvergenceAccelerator", init< double >()) + .def(init< Parameters& >()) .def("InitializeSolutionStep", &AitkenConvergenceAccelerator::InitializeSolutionStep) .def("UpdateSolution", &AitkenConvergenceAccelerator::UpdateSolution) .def("FinalizeNonLinearIteration", &AitkenConvergenceAccelerator::FinalizeNonLinearIteration) @@ -55,6 +56,7 @@ void AddConvergenceAcceleratorsToPython() // MVQN convergence accelerator class_< MVQNFullJacobianConvergenceAccelerator , bases , boost::noncopyable > ("MVQNFullJacobianConvergenceAccelerator", init< double >()) + .def(init< Parameters& >()) .def("InitializeSolutionStep", &MVQNFullJacobianConvergenceAccelerator::InitializeSolutionStep) .def("UpdateSolution", &MVQNFullJacobianConvergenceAccelerator::UpdateSolution) .def("FinalizeNonLinearIteration", &MVQNFullJacobianConvergenceAccelerator::FinalizeNonLinearIteration) @@ -63,6 +65,7 @@ void AddConvergenceAcceleratorsToPython() // MVQN recursive convergence accelerator class_< MVQNRecursiveJacobianConvergenceAccelerator , bases , boost::noncopyable > ("MVQNRecursiveJacobianConvergenceAccelerator", init< double, int >()) + .def(init< Parameters& >()) .def("Initialize", &MVQNRecursiveJacobianConvergenceAccelerator::Initialize) .def("InitializeSolutionStep", &MVQNRecursiveJacobianConvergenceAccelerator::InitializeSolutionStep) .def("UpdateSolution", &MVQNRecursiveJacobianConvergenceAccelerator::UpdateSolution) diff --git a/applications/FSIapplication/custom_python/add_custom_utilities_to_python.cpp b/applications/FSIapplication/custom_python/add_custom_utilities_to_python.cpp index 4dcc5b89405a..0a208e448335 100644 --- a/applications/FSIapplication/custom_python/add_custom_utilities_to_python.cpp +++ b/applications/FSIapplication/custom_python/add_custom_utilities_to_python.cpp @@ -21,6 +21,7 @@ #include "custom_utilities/FSI_utils.h" #include "custom_utilities/aitken_utils.h" #include "custom_utilities/partitioned_fsi_utilities.hpp" +#include "custom_utilities/nodal_update_utilities.h" #include "custom_utilities/variable_redistribution_utility.h" namespace Kratos @@ -33,35 +34,63 @@ void AddCustomUtilitiesToPython() { using namespace boost::python; typedef UblasSpace TSpace; + typedef NodalUpdateBaseClass< 2 > NodalUpdateBaseClass2DType; + typedef NodalUpdateBaseClass< 3 > NodalUpdateBaseClass3DType; class_("FSIUtils", init<>()) // .def("FSIUtils",&FSIUtils::GenerateCouplingElements) - .def("CheckPressureConvergence",&FSIUtils::CheckPressureConvergence) - .def("StructuralPressurePrediction",&FSIUtils::StructuralPressurePrediction) - ; + .def("CheckPressureConvergence",&FSIUtils::CheckPressureConvergence) + .def("StructuralPressurePrediction",&FSIUtils::StructuralPressurePrediction) + ; class_("AitkenUtils", init<>()) - .def("ComputeAitkenFactor",&AitkenUtils::ComputeAitkenFactor) - .def("ComputeRelaxedDisplacement",&AitkenUtils::ComputeRelaxedDisplacement) - ; + .def("ComputeAitkenFactor",&AitkenUtils::ComputeAitkenFactor) + .def("ComputeRelaxedDisplacement",&AitkenUtils::ComputeRelaxedDisplacement) + ; class_, boost::noncopyable >("PartitionedFSIUtilities2D", init< >()) - .def("GetInterfaceArea",&PartitionedFSIUtilities::GetInterfaceArea) - .def("GetInterfaceResidualSize",&PartitionedFSIUtilities::GetInterfaceResidualSize) - .def("SetInterfaceVectorVariable",&PartitionedFSIUtilities::SetInterfaceVectorVariable) - .def("SetAndFixInterfaceVectorVariable",&PartitionedFSIUtilities::SetAndFixInterfaceVectorVariable) - .def("ComputeInterfaceVectorResidual",&PartitionedFSIUtilities::ComputeInterfaceVectorResidual) - .def("ComputeFluidInterfaceMeshVelocityResidualNorm",&PartitionedFSIUtilities::ComputeFluidInterfaceMeshVelocityResidualNorm) - ; + .def("GetInterfaceArea",&PartitionedFSIUtilities::GetInterfaceArea) + .def("GetInterfaceResidualSize",&PartitionedFSIUtilities::GetInterfaceResidualSize) + .def("UpdateInterfaceValues",&PartitionedFSIUtilities::UpdateInterfaceValues) + .def("ComputeInterfaceVectorResidual",&PartitionedFSIUtilities::ComputeInterfaceVectorResidual) + .def("ComputeFluidInterfaceMeshVelocityResidualNorm",&PartitionedFSIUtilities::ComputeFluidInterfaceMeshVelocityResidualNorm) + .def("ComputeAndPrintFluidInterfaceNorms",&PartitionedFSIUtilities::ComputeAndPrintFluidInterfaceNorms) + .def("ComputeAndPrintStructureInterfaceNorms",&PartitionedFSIUtilities::ComputeAndPrintStructureInterfaceNorms) + .def("CheckCurrentCoordinatesFluid",&PartitionedFSIUtilities::CheckCurrentCoordinatesFluid) + .def("CheckCurrentCoordinatesStructure",&PartitionedFSIUtilities::CheckCurrentCoordinatesStructure) + ; class_, boost::noncopyable >("PartitionedFSIUtilities3D", init< >()) - .def("GetInterfaceArea",&PartitionedFSIUtilities::GetInterfaceArea) - .def("GetInterfaceResidualSize",&PartitionedFSIUtilities::GetInterfaceResidualSize) - .def("SetInterfaceVectorVariable",&PartitionedFSIUtilities::SetInterfaceVectorVariable) - .def("SetAndFixInterfaceVectorVariable",&PartitionedFSIUtilities::SetAndFixInterfaceVectorVariable) - .def("ComputeInterfaceVectorResidual",&PartitionedFSIUtilities::ComputeInterfaceVectorResidual) - .def("ComputeFluidInterfaceMeshVelocityResidualNorm",&PartitionedFSIUtilities::ComputeFluidInterfaceMeshVelocityResidualNorm) - ; + .def("GetInterfaceArea",&PartitionedFSIUtilities::GetInterfaceArea) + .def("GetInterfaceResidualSize",&PartitionedFSIUtilities::GetInterfaceResidualSize) + .def("UpdateInterfaceValues",&PartitionedFSIUtilities::UpdateInterfaceValues) + .def("ComputeInterfaceVectorResidual",&PartitionedFSIUtilities::ComputeInterfaceVectorResidual) + .def("ComputeFluidInterfaceMeshVelocityResidualNorm",&PartitionedFSIUtilities::ComputeFluidInterfaceMeshVelocityResidualNorm) + .def("ComputeAndPrintFluidInterfaceNorms",&PartitionedFSIUtilities::ComputeAndPrintFluidInterfaceNorms) + .def("ComputeAndPrintStructureInterfaceNorms",&PartitionedFSIUtilities::ComputeAndPrintStructureInterfaceNorms) + .def("CheckCurrentCoordinatesFluid",&PartitionedFSIUtilities::CheckCurrentCoordinatesFluid) + .def("CheckCurrentCoordinatesStructure",&PartitionedFSIUtilities::CheckCurrentCoordinatesStructure) + ; + + class_< NodalUpdateBaseClass <2>, boost::noncopyable > ("BaseNodalUpdate2D", init< >()) + .def("UpdateMeshTimeDerivatives", &NodalUpdateBaseClass<2>::UpdateMeshTimeDerivatives) + .def("UpdateTimeDerivativesOnInterface", &NodalUpdateBaseClass<2>::UpdateTimeDerivativesOnInterface) + ; + + class_< NodalUpdateBaseClass <3>, boost::noncopyable > ("BaseNodalUpdate3D", init< >()) + .def("UpdateMeshTimeDerivatives", &NodalUpdateBaseClass<3>::UpdateMeshTimeDerivatives) + .def("UpdateTimeDerivativesOnInterface", &NodalUpdateBaseClass<3>::UpdateTimeDerivativesOnInterface) + ; + + class_< NodalUpdateNewmark <2>, bases , boost::noncopyable > ("NodalUpdateNewmark2D", init< const double >()) + .def("UpdateMeshTimeDerivatives", &NodalUpdateNewmark<2>::UpdateMeshTimeDerivatives) + .def("UpdateTimeDerivativesOnInterface", &NodalUpdateNewmark<2>::UpdateTimeDerivativesOnInterface) + ; + + class_< NodalUpdateNewmark <3>, bases , boost::noncopyable > ("NodalUpdateNewmark3D", init< const double >()) + .def("UpdateMeshTimeDerivatives", &NodalUpdateNewmark<3>::UpdateMeshTimeDerivatives) + .def("UpdateTimeDerivativesOnInterface", &NodalUpdateNewmark<3>::UpdateTimeDerivativesOnInterface) + ; typedef void (*DistributePointDoubleType)(ModelPart&, const Variable< double >&, const Variable< double >&, double, unsigned int); typedef void (*DistributePointArrayType)(ModelPart&, const Variable< array_1d >&, const Variable< array_1d >&,double, unsigned int); diff --git a/applications/FSIapplication/custom_python/fsi_python_application.cpp b/applications/FSIapplication/custom_python/fsi_python_application.cpp index d808841f22e0..5ea668104447 100644 --- a/applications/FSIapplication/custom_python/fsi_python_application.cpp +++ b/applications/FSIapplication/custom_python/fsi_python_application.cpp @@ -43,25 +43,6 @@ BOOST_PYTHON_MODULE(KratosFSIApplication) AddMappersToPython(); AddConvergenceAcceleratorsToPython(); - //registering variables in python - KRATOS_REGISTER_IN_PYTHON_VARIABLE(CONVERGENCE_ACCELERATOR_ITERATION); - KRATOS_REGISTER_IN_PYTHON_VARIABLE(MAPPER_SCALAR_PROJECTION_RHS); - KRATOS_REGISTER_IN_PYTHON_VARIABLE(FICTITIOUS_FLUID_DENSITY); - KRATOS_REGISTER_IN_PYTHON_VARIABLE(SCALAR_PROJECTED); - KRATOS_REGISTER_IN_PYTHON_VARIABLE(FSI_INTERFACE_RESIDUAL_NORM); - KRATOS_REGISTER_IN_PYTHON_VARIABLE(FSI_INTERFACE_MESH_RESIDUAL_NORM); -// KRATOS_REGISTER_IN_PYTHON_VARIABLE(PRESSURE_OLD_IT); -// KRATOS_REGISTER_IN_PYTHON_VARIABLE(IS_INTERFACE); - - KRATOS_REGISTER_IN_PYTHON_3D_VARIABLE_WITH_COMPONENTS(MAPPER_VECTOR_PROJECTION_RHS); - KRATOS_REGISTER_IN_PYTHON_3D_VARIABLE_WITH_COMPONENTS(VAUX_EQ_TRACTION); - KRATOS_REGISTER_IN_PYTHON_3D_VARIABLE_WITH_COMPONENTS(VECTOR_PROJECTED); - KRATOS_REGISTER_IN_PYTHON_3D_VARIABLE_WITH_COMPONENTS(RELAXED_DISP); - KRATOS_REGISTER_IN_PYTHON_3D_VARIABLE_WITH_COMPONENTS(FSI_INTERFACE_RESIDUAL); - KRATOS_REGISTER_IN_PYTHON_3D_VARIABLE_WITH_COMPONENTS(FSI_INTERFACE_MESH_RESIDUAL); - KRATOS_REGISTER_IN_PYTHON_3D_VARIABLE_WITH_COMPONENTS(POSITIVE_MAPPED_VECTOR_VARIABLE); - KRATOS_REGISTER_IN_PYTHON_3D_VARIABLE_WITH_COMPONENTS(NEGATIVE_MAPPED_VECTOR_VARIABLE); - } diff --git a/applications/FSIapplication/custom_utilities/aitken_convergence_accelerator.hpp b/applications/FSIapplication/custom_utilities/aitken_convergence_accelerator.hpp index 6b01f433925c..fddb7dc820f0 100644 --- a/applications/FSIapplication/custom_utilities/aitken_convergence_accelerator.hpp +++ b/applications/FSIapplication/custom_utilities/aitken_convergence_accelerator.hpp @@ -14,12 +14,12 @@ /* System includes */ /* External includes */ -#include "boost/smart_ptr.hpp" #include "utilities/math_utils.h" /* Project includes */ #include "includes/define.h" #include "includes/variables.h" +#include "includes/kratos_parameters.h" #include "convergence_accelerator.hpp" namespace Kratos @@ -69,6 +69,22 @@ class AitkenConvergenceAccelerator: public ConvergenceAccelerator * Constructor. * Aitken convergence accelerator */ + AitkenConvergenceAccelerator(Parameters& rConvAcceleratorParameters) + { + Parameters aitken_default_parameters(R"( + { + "solver_type" : "Relaxation", + "acceleration_type" : "Aitken", + "w_0" : 0.825 + } + )"); + + rConvAcceleratorParameters.ValidateAndAssignDefaults(aitken_default_parameters); + + mOmega_0 = rConvAcceleratorParameters["w_0"].GetDouble(); + } + + AitkenConvergenceAccelerator(double rOmegaInitial = 0.825) { mOmega_0 = rOmegaInitial; @@ -128,13 +144,11 @@ class AitkenConvergenceAccelerator: public ConvergenceAccelerator { KRATOS_TRY; - // (*mpResidualVector_1) = rResidualVector; VectorPointerType pAux(new VectorType(rResidualVector)); std::swap(mpResidualVector_1, pAux); if (mConvergenceAcceleratorIteration == 1) { - // rIterationGuess += mOmega_0*mResidualVector_1; TSpace::UnaliasedAdd(rIterationGuess, mOmega_0, *mpResidualVector_1); } else @@ -142,14 +156,11 @@ class AitkenConvergenceAccelerator: public ConvergenceAccelerator VectorType Aux1minus0(*mpResidualVector_1); // Auxiliar copy of mResidualVector_1 TSpace::UnaliasedAdd(Aux1minus0, -1.0, *mpResidualVector_0); // mResidualVector_1 - mResidualVector_0 - // double num = inner_prod(mResidualVector_0,(mResidualVector_1-mResidualVector_0)); - // double den = inner_prod((mResidualVector_1-mResidualVector_0),(mResidualVector_1-mResidualVector_0)); double den = TSpace::Dot(Aux1minus0, Aux1minus0); double num = TSpace::Dot(*mpResidualVector_0, Aux1minus0); mOmega_1 = -mOmega_0*(num/den); - // rIterationGuess += mOmega_1*mResidualVector_1; TSpace::UnaliasedAdd(rIterationGuess, mOmega_1, *mpResidualVector_1); mOmega_0 = mOmega_1; } @@ -164,8 +175,8 @@ class AitkenConvergenceAccelerator: public ConvergenceAccelerator { KRATOS_TRY; - // *mResidualVector_0 = *mResidualVector_1; - mpResidualVector_0 = mpResidualVector_1; + // mpResidualVector_0 = mpResidualVector_1; + std::swap(mpResidualVector_0, mpResidualVector_1); mConvergenceAcceleratorIteration += 1; KRATOS_CATCH( "" ); diff --git a/applications/FSIapplication/custom_utilities/mvqn_convergence_accelerator.hpp b/applications/FSIapplication/custom_utilities/mvqn_convergence_accelerator.hpp index d831666053b1..8e496c45faed 100644 --- a/applications/FSIapplication/custom_utilities/mvqn_convergence_accelerator.hpp +++ b/applications/FSIapplication/custom_utilities/mvqn_convergence_accelerator.hpp @@ -14,13 +14,13 @@ /* System includes */ /* External includes */ -#include "boost/smart_ptr.hpp" #include "utilities/math_utils.h" /* Project includes */ #include "includes/define.h" #include "includes/variables.h" #include "includes/ublas_interface.h" +#include "includes/kratos_parameters.h" #include "convergence_accelerator.hpp" namespace Kratos @@ -73,6 +73,22 @@ class MVQNFullJacobianConvergenceAccelerator: public ConvergenceAcceleratorApplyJacobian(rWorkVector, rProjectedVector); mpOldJacobianEmulator->ApplyJacobian(pWorkVector, pProjectedVector); } else // When the JacobianEmulator has no PreviousJacobianEmulator consider minus the identity matrix as inverse Jacobian { - // TSpace::Assign(rProjectedVector,-1.0,rWorkVector); TSpace::Assign(*pProjectedVector, -1.0, *pWorkVector); } } else { + const unsigned int previous_iterations = mJacobianObsMatrixV.size(); + const unsigned int residual_size = TSpace::Size(mJacobianObsMatrixV[0]); - VectorPointerType pY(new VectorType(mJacobianObsMatrixV[0])); - VectorPointerType pW(new VectorType(mJacobianObsMatrixV[0])); - VectorPointerType pzQR(new VectorType(mJacobianObsMatrixV.size())); - MatrixPointerType pAuxMatQR(new MatrixType(TSpace::Size(mJacobianObsMatrixV[0]), mJacobianObsMatrixV.size())); + VectorPointerType pY(new VectorType(residual_size)); + VectorPointerType pW(new VectorType(residual_size)); + VectorPointerType pzQR(new VectorType(previous_iterations)); + MatrixPointerType pAuxMatQR(new MatrixType(residual_size, previous_iterations)); // Loop to store a std::vector type as Matrix type - for (unsigned int i = 0; i < TSpace::Size(mJacobianObsMatrixV[0]); i++) + for (unsigned int i = 0; i < residual_size; ++i) { - for (unsigned int j = 0; j < mJacobianObsMatrixV.size(); j++) + for (unsigned int j = 0; j < previous_iterations; ++j) { - // auxMatQR(i,j) = mJacobianObsMatrixV[j](i); (*pAuxMatQR)(i,j) = mJacobianObsMatrixV[j](i); } } @@ -210,13 +209,11 @@ class JacobianEmulator VectorPointerType pWorkVectorCopy(new VectorType(*pWorkVector)); // QR decomposition to compute ((V_k.T*V_k)^-1)*V_k.T*r_k - // TODO: Implement an if(!frozen) to avoid the recomputation of the inverse matrix each time the OldJacobianEmulator is called - mQR_decomposition.compute(TSpace::Size(mJacobianObsMatrixV[0]), mJacobianObsMatrixV.size(), &(*pAuxMatQR)(0,0)); + mQR_decomposition.compute(residual_size, previous_iterations, &(*pAuxMatQR)(0,0)); mQR_decomposition.solve(&(*pWorkVectorCopy)(0), &(*pzQR)(0)); - // TODO: PARALLELIZE THIS OPERATION (it cannot be done with TSpace::Dot beacuse the obs matrices are stored by columns) TSpace::SetToZero(*pY); - for (unsigned int j = 0; j < mJacobianObsMatrixV.size(); j++) + for (unsigned int j = 0; j < previous_iterations; ++j) { TSpace::UnaliasedAdd(*pY, (*pzQR)(j), mJacobianObsMatrixV[j]); } @@ -236,7 +233,7 @@ class JacobianEmulator // w = W_k*z TSpace::SetToZero(*pW); - for (unsigned int j = 0; j < mJacobianObsMatrixV.size(); j++) + for (unsigned int j = 0; j < previous_iterations; ++j) { TSpace::UnaliasedAdd(*pW, (*pzQR)(j), mJacobianObsMatrixW[j]); } @@ -433,6 +430,25 @@ class MVQNRecursiveJacobianConvergenceAccelerator: public ConvergenceAccelerator * Constructor. * MVQN convergence accelerator */ + MVQNRecursiveJacobianConvergenceAccelerator( Parameters &rConvAcceleratorParameters ) + { + Parameters mvqn_recursive_default_parameters(R"( + { + "solver_type" : "MVQN", + "w_0" : 0.825, + "buffer_size" : 10 + } + )"); + + rConvAcceleratorParameters.ValidateAndAssignDefaults(mvqn_recursive_default_parameters); + + mOmega_0 = rConvAcceleratorParameters["w_0"].GetDouble(); + mJacobianBufferSize = rConvAcceleratorParameters["buffer_size"].GetInt(); + mConvergenceAcceleratorStep = 0; + mConvergenceAcceleratorIteration = 0; + mConvergenceAcceleratorFirstCorrectionPerformed = false; + } + MVQNRecursiveJacobianConvergenceAccelerator( double rOmegaInitial = 0.825, unsigned int rJacobianBufferSize = 10 ) { mOmega_0 = rOmegaInitial; diff --git a/applications/FSIapplication/custom_utilities/nodal_update_utilities.h b/applications/FSIapplication/custom_utilities/nodal_update_utilities.h new file mode 100644 index 000000000000..c284308e3618 --- /dev/null +++ b/applications/FSIapplication/custom_utilities/nodal_update_utilities.h @@ -0,0 +1,395 @@ +// | / | +// ' / __| _` | __| _ \ __| +// . \ | ( | | ( |\__ \. +// _|\_\_| \__,_|\__|\___/ ____/ +// Multi-Physics +// +// License: BSD License +// Original author: Ruben Zorrilla +// + +#if !defined( KRATOS_NODAL_UPDATE_UTILITIES ) +#define KRATOS_NODAL_UPDATE_UTILITIES + + +/* System includes */ +#include + +/* External includes */ + +/* Project includes */ +#include "includes/define.h" +#include "includes/variables.h" +#include "includes/ale_variables.h" +#include "includes/fsi_variables.h" +#include "containers/array_1d.h" +#include "includes/model_part.h" +#include "includes/communicator.h" +#include "includes/ublas_interface.h" +#include "utilities/openmp_utils.h" +#include "utilities/variable_utils.h" + + +namespace Kratos +{ + +/**@name Kratos Globals */ +/*@{ */ + +/*@} */ +/**@name Type Definitions */ +/*@{ */ + +/*@} */ +/**@name Enum's */ +/*@{ */ + +/*@} */ +/**@name Functions */ +/*@{ */ + +/*@} */ +/**@name Kratos Classes */ +/*@{ */ + +/** Short class definition. +Detail class definition. +*/ +template +class NodalUpdateBaseClass +{ + +public: + + /** Type Definitions + */ + + /*@{ */ + + //~ /** Counted pointer of ClassName */ + KRATOS_CLASS_POINTER_DEFINITION( NodalUpdateBaseClass ); + /*@} */ + + /** Constructor. + */ + + /** + * Empty constructor + */ + NodalUpdateBaseClass() + { + } + + /*@} */ + + /** Copy constructor. + */ + + /*@{ */ + NodalUpdateBaseClass(const NodalUpdateBaseClass& Other); + /*@{ */ + + /** Destructor. + */ + + /*@{ */ + virtual ~NodalUpdateBaseClass() + { + } + + /*@} */ + /**@name Public Operators*/ + /*@{ */ + + /** + * Computes the displacement time derivatives according to the computed displacement values. + * @param rInterfaceModelPart: modelpart in where the nodal update is to be performed + * @param timeStep: time step value + */ + virtual void UpdateMeshTimeDerivatives(ModelPart& rModelPart, + const double timeStep) + { + } + + /** + * Sets the fluid interface time derivatives as the mesh displacement computed values. + * @param rInterfaceModelPart: modelpart in where the nodal update is to be performed + */ + virtual void UpdateTimeDerivativesOnInterface(ModelPart& rInterfaceModelPart) + { + auto& rLocalMesh = rInterfaceModelPart.GetCommunicator().LocalMesh(); + ModelPart::NodeIterator local_mesh_nodes_begin = rLocalMesh.NodesBegin(); + #pragma omp parallel for firstprivate(local_mesh_nodes_begin) + for(int k=0; k(rLocalMesh.NumberOfNodes()); ++k) + { + ModelPart::NodeIterator it_node = local_mesh_nodes_begin+k; + + array_1d& v_node = it_node->FastGetSolutionStepValue(VELOCITY); // Current step interface velocity + array_1d& a_node = it_node->FastGetSolutionStepValue(ACCELERATION); // Current step interface acceleration + + noalias(v_node) = it_node->FastGetSolutionStepValue(MESH_VELOCITY); // Set the current interface velocity as the mesh velocity; + noalias(a_node) = it_node->FastGetSolutionStepValue(MESH_ACCELERATION); // Set the current interface acceleration as the mesh acceleration; + } + + rInterfaceModelPart.GetCommunicator().SynchronizeVariable(VELOCITY); + rInterfaceModelPart.GetCommunicator().SynchronizeVariable(ACCELERATION); + } + + /*@} */ + +protected: + + /**@name Protected static Member Variables */ + /*@{ */ + + + /*@} */ + /**@name Protected member Variables */ + /*@{ */ + + + /*@} */ + /**@name Protected Operators*/ + /*@{ */ + + + /*@} */ + /**@name Protected Operations*/ + /*@{ */ + + + /**@} */ + /**@name Protected Access */ + /*@{ */ + + + /*@} */ + /**@name Protected Inquiry */ + /*@{ */ + + + /*@} */ + /**@name Protected LifeCycle */ + /*@{ */ + +private: + + /*@} */ + /**@name Static Member Variables */ + /*@{ */ + + + /*@} */ + /**@name Member Variables */ + /*@{ */ + + + /*@} */ + /**@name Private Operators*/ + /*@{ */ + + + /*@} */ + /**@name Private Operations*/ + /*@{ */ + + + /*@} */ + /**@name Private Access */ + /*@{ */ + + + /*@} */ + /**@name Private Inquiry */ + /*@{ */ + + + /*@} */ + /**@name Un accessible methods */ + /*@{ */ + + /*@} */ + +}; /* Class NodalUpdateBaseClass */ + + +/** Short class definition. +Detail class definition. +*/ +template +class NodalUpdateNewmark : public NodalUpdateBaseClass +{ + +public: + + /** Type Definitions + */ + + /*@{ */ + + //~ /** Counted pointer of ClassName */ + KRATOS_CLASS_POINTER_DEFINITION( NodalUpdateNewmark ); + /*@} */ + + /** Constructor. + */ + + /** + * Empty constructor + */ + NodalUpdateNewmark(const double BossakAlpha = -0.3) + { + mBossakAlpha = BossakAlpha; + mBossakBeta = 0.5 - mBossakAlpha; + mBossakGamma = 0.25*std::pow(1.0 - mBossakAlpha, 2.0); + } + + + /*@} */ + + /** Copy constructor. + */ + + /*@{ */ + NodalUpdateNewmark(const NodalUpdateNewmark& Other); + /*@{ */ + + /** Destructor. + */ + + /*@{ */ + virtual ~NodalUpdateNewmark() + { + } + + /*@} */ + /**@name Public Operators*/ + /*@{ */ + + /** + * Computes the displacement time derivatives according to the computed displacement values using the Newmark (Bossak) scheme. + * @param rModelPart: modelpart in where the nodal update is to be performed + * @param timeStep: time step value + */ + virtual void UpdateTimeDerivatives(ModelPart& rModelPart, + const double timeStep) + { + + auto& rLocalMesh = rModelPart.GetCommunicator().LocalMesh(); + ModelPart::NodeIterator local_mesh_nodes_begin = rLocalMesh.NodesBegin(); + #pragma omp parallel for firstprivate(local_mesh_nodes_begin) + for(int k=0; k(rLocalMesh.NumberOfNodes()); ++k) + { + const ModelPart::NodeIterator it_node = local_mesh_nodes_begin+k; + + const array_1d& umesh_n = it_node->FastGetSolutionStepValue(MESH_DISPLACEMENT, 1); // Previous step mesh displacement + const array_1d& vmesh_n = it_node->FastGetSolutionStepValue(MESH_VELOCITY, 1); // Previous step mesh velocity + const array_1d& amesh_n = it_node->FastGetSolutionStepValue(MESH_ACCELERATION, 1); // Previous step mesh acceleration + + const array_1d& umesh_n1 = it_node->FastGetSolutionStepValue(MESH_DISPLACEMENT); // Current step mesh displacement + array_1d& vmesh_n1 = it_node->FastGetSolutionStepValue(MESH_VELOCITY); // Current step mesh velocity (to be updated) + array_1d& amesh_n1 = it_node->FastGetSolutionStepValue(MESH_ACCELERATION); // Current step mesh acceleration (to be updated) + + for (unsigned int jj=0; jj(rInterfaceModelPart.NumberOfConditions()); ++k) + auto& rLocalMesh = rInterfaceModelPart.GetCommunicator().LocalMesh(); + ModelPart::ConditionIterator local_mesh_conditions_begin = rLocalMesh.ConditionsBegin(); + #pragma omp parallel for firstprivate(local_mesh_conditions_begin) reduction(+:interface_area) + for(int k=0; k < static_cast(rLocalMesh.NumberOfConditions()); ++k) { - ModelPart::ConditionIterator it_cond = rInterfaceModelPart.ConditionsBegin()+k; - + const ModelPart::ConditionIterator it_cond = local_mesh_conditions_begin+k; const Condition::GeometryType& rGeom = it_cond->GetGeometry(); - InterfaceArea += rGeom.Length(); + interface_area += rGeom.Length(); } - rInterfaceModelPart.GetCommunicator().SumAll(InterfaceArea); + rInterfaceModelPart.GetCommunicator().SumAll(interface_area); - return InterfaceArea; + return interface_area; } /** - * This function sets the variable data contained in a vector over the the - * fluid interface. - * @param rInterfaceModelPart: interface modelpart in where the vector variable is set - * @param rVariable: variable to be set - * @param rInterfaceDataVector: vector containing the data values to be set + * This function resizes and sets to zero an interface vector (length equal to the + * residual size). + * @param rInterfaceModelPart: interface modelpart in where the residual is computed + * @param pInterfaceVector: pointer to the vector that is to be resized */ - void SetInterfaceVectorVariable(ModelPart& rInterfaceModelPart, - const Variable >& rVariable, - const VectorType& rInterfaceDataVector) + virtual void SetUpInterfaceVector(ModelPart& rInterfaceModelPart, + VectorPointerType& pInterfaceVector) { - // Initialize the variable value - VariableUtils().SetToZero_VectorVar(rVariable, rInterfaceModelPart.Nodes()); - - #pragma omp parallel for - for(int k=0; k(rInterfaceModelPart.NumberOfNodes()); ++k) + unsigned int ResidualSize = this->GetInterfaceResidualSize(rInterfaceModelPart); + if ( TSpace::Size(*pInterfaceVector) != ResidualSize ) { - ModelPart::NodeIterator it_node = rInterfaceModelPart.NodesBegin()+k; - unsigned int base_i = k*TDim; - - array_1d& value_to_set = it_node->FastGetSolutionStepValue(rVariable); - for (unsigned int jj=0; jj >& rVariable, - const VectorType& rFluidInterfaceDataVector, - const bool FixVariable) - { - this->SetInterfaceVectorVariable(rInterfaceModelPart, rVariable, rFluidInterfaceDataVector); - // If needed, apply fixity to rVariable - if (FixVariable) - { - // Get the variable components - typedef VariableComponent< VectorComponentAdaptor > > component_type; - - const std::string variable_name = rVariable.Name(); - const component_type varx = KratosComponents< component_type >::Get(variable_name+std::string("_X")); - const component_type vary = KratosComponents< component_type >::Get(variable_name+std::string("_Y")); - const component_type varz = KratosComponents< component_type >::Get(variable_name+std::string("_Z")); - - // Fix the variable components - VariableUtils().ApplyFixity(varx, true, rInterfaceModelPart.Nodes()); - VariableUtils().ApplyFixity(vary, true, rInterfaceModelPart.Nodes()); - VariableUtils().ApplyFixity(varz, true, rInterfaceModelPart.Nodes()); - } + TSpace::SetToZero(*pInterfaceVector); } /** @@ -206,12 +172,12 @@ class PartitionedFSIUtilities * @param rInterfaceModelPart: interface modelpart in where the residual is computed * @param interface_residual: reference to the residual vector */ - void ComputeInterfaceVectorResidual(ModelPart& rInterfaceModelPart, - const Variable >& rOriginalVariable, - const Variable >& rModifiedVariable, - VectorType& interface_residual) // TODO: MPI parallelization + virtual void ComputeInterfaceVectorResidual(ModelPart& rInterfaceModelPart, + const Variable >& rOriginalVariable, + const Variable >& rModifiedVariable, + VectorType& interface_residual) { - interface_residual = ZeroVector(this->GetInterfaceResidualSize(rInterfaceModelPart)); + TSpace::SetToZero(interface_residual); // Compute node-by-node residual this->ComputeNodeByNodeResidual(rInterfaceModelPart, rOriginalVariable, rModifiedVariable, FSI_INTERFACE_RESIDUAL); @@ -220,23 +186,25 @@ class PartitionedFSIUtilities // this->ComputeConsistentResidual(rInterfaceModelPart, rOriginalVariable, rModifiedVariable, FSI_INTERFACE_RESIDUAL); // Assemble the final consistent residual values - #pragma omp parallel for - for(int k=0; k(rInterfaceModelPart.NumberOfNodes()); ++k) + auto& rLocalMesh = rInterfaceModelPart.GetCommunicator().LocalMesh(); + ModelPart::NodeIterator local_mesh_nodes_begin = rLocalMesh.NodesBegin(); + #pragma omp parallel for firstprivate(local_mesh_nodes_begin) + for(int k=0; k(rLocalMesh.NumberOfNodes()); ++k) { - const ModelPart::NodeIterator it_node = rInterfaceModelPart.NodesBegin()+k; + const ModelPart::NodeIterator it_node = local_mesh_nodes_begin+k; const unsigned int base_i = k*TDim; const array_1d& fsi_res = it_node->FastGetSolutionStepValue(FSI_INTERFACE_RESIDUAL); for (unsigned int jj=0; jjSetLocalValue(interface_residual, base_i+jj, fsi_res[jj]); } } // Store the L2 norm of the error in the fluid process info rInterfaceModelPart.GetProcessInfo().GetValue(FSI_INTERFACE_RESIDUAL_NORM) = TSpace::TwoNorm(interface_residual); - }; + } /** * This function computes the mesh velocity residual over the fluid interface. @@ -247,94 +215,246 @@ class PartitionedFSIUtilities * the FSI_INTERFACE_MESH_RESIDUAL_NORM variable. * @param rFluidInterfaceModelPart: interface modelpart in where the residual is computed */ - void ComputeFluidInterfaceMeshVelocityResidualNorm(ModelPart& rFluidInterfaceModelPart) // TODO: MPI parallelization + void ComputeFluidInterfaceMeshVelocityResidualNorm(ModelPart& rFluidInterfaceModelPart) { - - VectorType fluid_interface_mesh_residual = ZeroVector(this->GetInterfaceResidualSize(rFluidInterfaceModelPart)); + VectorPointerType pFluidInterfaceMeshResidual = TSpace::CreateEmptyVectorPointer(); + this->SetUpInterfaceVector(rFluidInterfaceModelPart, pFluidInterfaceMeshResidual); // Compute node-by-node residual - // this->ComputeNodeByNodeResidual(rFluidInterfaceModelPart, VELOCITY, MESH_VELOCITY, FSI_INTERFACE_MESH_RESIDUAL); + this->ComputeNodeByNodeResidual(rFluidInterfaceModelPart, VELOCITY, MESH_VELOCITY, FSI_INTERFACE_MESH_RESIDUAL); // Compute consitent residual - this->ComputeConsistentResidual(rFluidInterfaceModelPart, VELOCITY, MESH_VELOCITY, FSI_INTERFACE_MESH_RESIDUAL); + // this->ComputeConsistentResidual(rFluidInterfaceModelPart, VELOCITY, MESH_VELOCITY, FSI_INTERFACE_MESH_RESIDUAL); // Assemble the final consistent residual values - #pragma omp parallel for - for(int k=0; k(rFluidInterfaceModelPart.NumberOfNodes()); ++k) + auto& rLocalMesh = rFluidInterfaceModelPart.GetCommunicator().LocalMesh(); + ModelPart::NodeIterator local_mesh_nodes_begin = rLocalMesh.NodesBegin(); + #pragma omp parallel for firstprivate(local_mesh_nodes_begin) + for(int k=0; k(rLocalMesh.NumberOfNodes()); ++k) { - const ModelPart::NodeIterator it_node = rFluidInterfaceModelPart.NodesBegin()+k; + const ModelPart::NodeIterator it_node = local_mesh_nodes_begin+k; const unsigned int base_i = k*TDim; const array_1d& fsi_mesh_res = it_node->FastGetSolutionStepValue(FSI_INTERFACE_MESH_RESIDUAL); for (unsigned int jj=0; jjSetLocalValue(*pFluidInterfaceMeshResidual, base_i+jj, fsi_mesh_res[jj]); } } // Store the L2 norm of the error in the fluid process info - rFluidInterfaceModelPart.GetProcessInfo().GetValue(FSI_INTERFACE_MESH_RESIDUAL_NORM) = TSpace::TwoNorm(fluid_interface_mesh_residual); + rFluidInterfaceModelPart.GetProcessInfo().GetValue(FSI_INTERFACE_MESH_RESIDUAL_NORM) = TSpace::TwoNorm(*pFluidInterfaceMeshResidual); } - /*@} */ + /** + * Sets the values in the corrected guess vector in the selected nodal variable. + * @param rInterfaceModelPart: interface modelpart in where the residual is computed + * @param rSolutionVariable: variable in where the corrected solution is to be stored + * @param rCorrectedGuess: vector containing the interface corrected values + */ + virtual void UpdateInterfaceValues(ModelPart& rInterfaceModelPart, + const Variable >& rSolutionVariable, + VectorType& rCorrectedGuess) + { + auto& rLocalMesh = rInterfaceModelPart.GetCommunicator().LocalMesh(); + ModelPart::NodeIterator local_mesh_nodes_begin = rLocalMesh.NodesBegin(); + #pragma omp parallel for firstprivate(local_mesh_nodes_begin) + for(int k=0; k(rLocalMesh.NumberOfNodes()); ++k) + { + const ModelPart::NodeIterator it_node = local_mesh_nodes_begin+k; + const unsigned int base_i = k*TDim; -protected: - /**@name Protected static Member Variables */ - /*@{ */ + array_1d& updated_value = it_node->FastGetSolutionStepValue(rSolutionVariable); + for (unsigned int jj=0; jjGetLocalValue( rCorrectedGuess, base_i+jj ); + } + } - // ModelPart& mrFluidInterfaceModelPart; - // ModelPart& mrStructureInterfaceModelPart; + rInterfaceModelPart.GetCommunicator().SynchronizeVariable(rSolutionVariable); + } - /*@} */ - /**@name Protected member Variables */ - /*@{ */ + /** + * Computes and prints the fluid interface residual norms for debugging purposes + * @param rInterfaceModelPart: interface modelpart in where the residual is computed + */ + virtual void ComputeAndPrintFluidInterfaceNorms(ModelPart& rInterfaceModelPart) + { + double p_norm = 0.0; + double vx_norm = 0.0; + double vy_norm = 0.0; + double vz_norm = 0.0; + double rx_norm = 0.0; + double ry_norm = 0.0; + double rz_norm = 0.0; + double ux_mesh_norm = 0.0; + double uy_mesh_norm = 0.0; + double uz_mesh_norm = 0.0; + + auto& rLocalMesh = rInterfaceModelPart.GetCommunicator().LocalMesh(); + ModelPart::NodeIterator local_mesh_nodes_begin = rLocalMesh.NodesBegin(); + #pragma omp parallel for firstprivate(local_mesh_nodes_begin) reduction(+ : p_norm, vx_norm, vy_norm, vz_norm, rx_norm, ry_norm, rz_norm, ux_mesh_norm, uy_mesh_norm, uz_mesh_norm) + for(int k=0; k(rLocalMesh.NumberOfNodes()); ++k) + { + const ModelPart::NodeIterator it_node = local_mesh_nodes_begin+k; + + p_norm += std::pow(it_node->FastGetSolutionStepValue(PRESSURE), 2); + vx_norm += std::pow(it_node->FastGetSolutionStepValue(VELOCITY_X), 2); + vy_norm += std::pow(it_node->FastGetSolutionStepValue(VELOCITY_Y), 2); + vz_norm += std::pow(it_node->FastGetSolutionStepValue(VELOCITY_Z), 2); + rx_norm += std::pow(it_node->FastGetSolutionStepValue(REACTION_X), 2); + ry_norm += std::pow(it_node->FastGetSolutionStepValue(REACTION_Y), 2); + rz_norm += std::pow(it_node->FastGetSolutionStepValue(REACTION_Z), 2); + ux_mesh_norm += std::pow(it_node->FastGetSolutionStepValue(MESH_DISPLACEMENT_X), 2); + uy_mesh_norm += std::pow(it_node->FastGetSolutionStepValue(MESH_DISPLACEMENT_Y), 2); + uz_mesh_norm += std::pow(it_node->FastGetSolutionStepValue(MESH_DISPLACEMENT_Z), 2); + } - /*@} */ - /**@name Protected Operators*/ - /*@{ */ + rInterfaceModelPart.GetCommunicator().SumAll(p_norm); + rInterfaceModelPart.GetCommunicator().SumAll(vx_norm); + rInterfaceModelPart.GetCommunicator().SumAll(vy_norm); + rInterfaceModelPart.GetCommunicator().SumAll(vz_norm); + rInterfaceModelPart.GetCommunicator().SumAll(rx_norm); + rInterfaceModelPart.GetCommunicator().SumAll(ry_norm); + rInterfaceModelPart.GetCommunicator().SumAll(rz_norm); + rInterfaceModelPart.GetCommunicator().SumAll(ux_mesh_norm); + rInterfaceModelPart.GetCommunicator().SumAll(uy_mesh_norm); + rInterfaceModelPart.GetCommunicator().SumAll(uz_mesh_norm); + + if (rInterfaceModelPart.GetCommunicator().MyPID() == 0) + { + std::cout << " " << std::endl; + std::cout << "|p_norm| = " << std::sqrt(p_norm) << std::endl; + std::cout << "|vx_norm| = " << std::sqrt(vx_norm) << std::endl; + std::cout << "|vy_norm| = " << std::sqrt(vy_norm) << std::endl; + std::cout << "|vz_norm| = " << std::sqrt(vz_norm) << std::endl; + std::cout << "|rx_norm| = " << std::sqrt(rx_norm) << std::endl; + std::cout << "|ry_norm| = " << std::sqrt(ry_norm) << std::endl; + std::cout << "|rz_norm| = " << std::sqrt(rz_norm) << std::endl; + std::cout << "|ux_mesh_norm| = " << std::sqrt(ux_mesh_norm) << std::endl; + std::cout << "|uy_mesh_norm| = " << std::sqrt(uy_mesh_norm) << std::endl; + std::cout << "|uz_mesh_norm| = " << std::sqrt(uz_mesh_norm) << std::endl; + std::cout << " " << std::endl; + } + } + /** + * Computes and prints the structure interface residual norms for debugging purposes + * @param rInterfaceModelPart: interface modelpart in where the residual is computed + */ + virtual void ComputeAndPrintStructureInterfaceNorms(ModelPart& rInterfaceModelPart) + { + double ux_norm = 0.0; + double uy_norm = 0.0; + double uz_norm = 0.0; + + auto& rLocalMesh = rInterfaceModelPart.GetCommunicator().LocalMesh(); + ModelPart::NodeIterator local_mesh_nodes_begin = rLocalMesh.NodesBegin(); + #pragma omp parallel for firstprivate(local_mesh_nodes_begin) reduction(+ : ux_norm, uy_norm, uz_norm) + for(int k=0; k(rLocalMesh.NumberOfNodes()); ++k) + { + const ModelPart::NodeIterator it_node = local_mesh_nodes_begin+k; + const array_1d& disp = it_node->FastGetSolutionStepValue(DISPLACEMENT); - /*@} */ - /**@name Protected Operations*/ - /*@{ */ + ux_norm += std::pow(disp[0], 2); + uy_norm += std::pow(disp[1], 2); + uz_norm += std::pow(disp[2], 2); + } + rInterfaceModelPart.GetCommunicator().SumAll(ux_norm); + rInterfaceModelPart.GetCommunicator().SumAll(uy_norm); + rInterfaceModelPart.GetCommunicator().SumAll(uz_norm); - /*@} */ - /**@name Protected Access */ - /*@{ */ + if (rInterfaceModelPart.GetCommunicator().MyPID() == 0) + { + std::cout << " " << std::endl; + std::cout << "|ux_norm| = " << std::sqrt(ux_norm) << std::endl; + std::cout << "|uy_norm| = " << std::sqrt(uy_norm) << std::endl; + std::cout << "|uz_norm| = " << std::sqrt(uz_norm) << std::endl; + std::cout << " " << std::endl; + } + } + /** + * Checks if X = X0 + deltaX + * @param rModelPart: reference to the model part in where the check has to be performed + */ + virtual void CheckCurrentCoordinatesFluid(ModelPart& rModelPart, const double tolerance) + { + auto& rLocalMesh = rModelPart.GetCommunicator().LocalMesh(); + ModelPart::NodeIterator local_mesh_nodes_begin = rLocalMesh.NodesBegin(); + #pragma omp parallel for firstprivate(local_mesh_nodes_begin) + for(int k=0; k(rLocalMesh.NumberOfNodes()); ++k) + { + const ModelPart::NodeIterator it_node = local_mesh_nodes_begin+k; + const array_1d& disp = it_node->FastGetSolutionStepValue(MESH_DISPLACEMENT); - /*@} */ - /**@name Protected Inquiry */ - /*@{ */ + if (std::fabs(it_node->X() - (it_node->X0() + disp[0])) > tolerance) + { + KRATOS_ERROR << "Node " << it_node->Id() << " X != X0 + deltaX"; + } + if (std::fabs(it_node->Y() - (it_node->Y0() + disp[1])) > tolerance) + { + KRATOS_ERROR << "Node " << it_node->Id() << " Y != Y0 + deltaY"; + } + if (std::fabs(it_node->Z() - (it_node->Z0() + disp[2])) > tolerance) + { + KRATOS_ERROR << "Node " << it_node->Id() << " Z != Z0 + deltaZ"; + } + } + } + + /** + * Checks if X = X0 + deltaX + * @param rModelPart: reference to the model part in where the check has to be performed + */ + virtual void CheckCurrentCoordinatesStructure(ModelPart& rModelPart, const double tolerance) + { + auto& rLocalMesh = rModelPart.GetCommunicator().LocalMesh(); + ModelPart::NodeIterator local_mesh_nodes_begin = rLocalMesh.NodesBegin(); + #pragma omp parallel for firstprivate(local_mesh_nodes_begin) + for(int k=0; k(rLocalMesh.NumberOfNodes()); ++k) + { + const ModelPart::NodeIterator it_node = local_mesh_nodes_begin+k; + const array_1d& disp = it_node->FastGetSolutionStepValue(DISPLACEMENT); + if (std::fabs(it_node->X() - (it_node->X0() + disp[0])) > tolerance) + { + KRATOS_ERROR << "Node " << it_node->Id() << " X != X0 + deltaX"; + } + if (std::fabs(it_node->Y() - (it_node->Y0() + disp[1])) > tolerance) + { + KRATOS_ERROR << "Node " << it_node->Id() << " Y != Y0 + deltaY"; + } + if (std::fabs(it_node->Z() - (it_node->Z0() + disp[2])) > tolerance) + { + KRATOS_ERROR << "Node " << it_node->Id() << " Z != Z0 + deltaZ"; + } + } + } /*@} */ - /**@name Protected LifeCycle */ - /*@{ */ -private: +protected: - /*@} */ - /**@name Static Member Variables */ + /**@name Protected static Member Variables */ /*@{ */ - /*@} */ - /**@name Member Variables */ + /**@name Protected member Variables */ /*@{ */ - /*@} */ - /**@name Private Operators*/ + /**@name Protected Operators*/ /*@{ */ /*@} */ - /**@name Private Operations*/ + /**@name Protected Operations*/ /*@{ */ + /** * This function computes the nodal error of a vector magnitude. The error is defined * as OriginalVariable minus ModifiedVariable. @@ -349,14 +469,16 @@ class PartitionedFSIUtilities const Variable >& rErrorStorageVariable) { // Initialize the residual storage variable - VariableUtils().SetToZero_VectorVar(rErrorStorageVariable, rInterfaceModelPart.Nodes()); + VariableUtils().SetToZero_VectorVar(rErrorStorageVariable, rInterfaceModelPart.GetCommunicator().LocalMesh().Nodes()); - #pragma omp parallel for - for(int k=0; k(rInterfaceModelPart.NumberOfNodes()); ++k) + auto& rLocalMesh = rInterfaceModelPart.GetCommunicator().LocalMesh(); + ModelPart::NodeIterator local_mesh_nodes_begin = rLocalMesh.NodesBegin(); + #pragma omp parallel for firstprivate(local_mesh_nodes_begin) + for(int k=0; k(rLocalMesh.NumberOfNodes()); ++k) { - ModelPart::NodeIterator it_node = rInterfaceModelPart.NodesBegin()+k; - array_1d& rErrorStorage = it_node->FastGetSolutionStepValue(rErrorStorageVariable); + ModelPart::NodeIterator it_node = local_mesh_nodes_begin+k; + array_1d& rErrorStorage = it_node->FastGetSolutionStepValue(rErrorStorageVariable); const array_1d& value_fluid = it_node->FastGetSolutionStepValue(rOriginalVariable); const array_1d& value_fluid_projected = it_node->FastGetSolutionStepValue(rModifiedVariable); @@ -456,6 +578,52 @@ class PartitionedFSIUtilities } } + virtual void SetLocalValue(VectorType& rVector, int LocalRow, double Value) const + { + TSpace::SetValue(rVector,LocalRow,Value); + } + + virtual double GetLocalValue(VectorType& rVector, int LocalRow) const + { + return TSpace::GetValue(rVector,LocalRow); + } + + /**@} */ + /**@name Protected Access */ + /*@{ */ + + + /*@} */ + /**@name Protected Inquiry */ + /*@{ */ + + + /*@} */ + /**@name Protected LifeCycle */ + /*@{ */ + +private: + + /*@} */ + /**@name Static Member Variables */ + /*@{ */ + + + /*@} */ + /**@name Member Variables */ + /*@{ */ + + + /*@} */ + /**@name Private Operators*/ + /*@{ */ + + + /*@} */ + /**@name Private Operations*/ + /*@{ */ + + /*@} */ /**@name Private Access */ /*@{ */ diff --git a/applications/FSIapplication/fsi_application.cpp b/applications/FSIapplication/fsi_application.cpp index 1dd892d76971..8cbbe362ea18 100644 --- a/applications/FSIapplication/fsi_application.cpp +++ b/applications/FSIapplication/fsi_application.cpp @@ -22,25 +22,6 @@ namespace Kratos { -//Example -KRATOS_CREATE_VARIABLE(int, CONVERGENCE_ACCELERATOR_ITERATION); -KRATOS_CREATE_VARIABLE(double, MAPPER_SCALAR_PROJECTION_RHS); -KRATOS_CREATE_VARIABLE(double, SCALAR_PROJECTED); -KRATOS_CREATE_VARIABLE(double, FICTITIOUS_FLUID_DENSITY); -KRATOS_CREATE_VARIABLE(double, FSI_INTERFACE_RESIDUAL_NORM); -KRATOS_CREATE_VARIABLE(double, FSI_INTERFACE_MESH_RESIDUAL_NORM); -// KRATOS_CREATE_VARIABLE(double, PRESSURE_OLD_IT) - -// KRATOS_CREATE_VARIABLE(double, IS_INTERFACE); - -KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(MAPPER_VECTOR_PROJECTION_RHS); -KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(VAUX_EQ_TRACTION); -KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(VECTOR_PROJECTED); -KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(RELAXED_DISP); -KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(FSI_INTERFACE_RESIDUAL); -KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(FSI_INTERFACE_MESH_RESIDUAL); -KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(POSITIVE_MAPPED_VECTOR_VARIABLE); -KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(NEGATIVE_MAPPED_VECTOR_VARIABLE); void KratosFSIApplication::Register() { @@ -48,25 +29,6 @@ void KratosFSIApplication::Register() KratosApplication::Register(); std::cout << "Initializing KratosFSIApplication... " << std::endl; - KRATOS_REGISTER_VARIABLE(CONVERGENCE_ACCELERATOR_ITERATION); - KRATOS_REGISTER_VARIABLE(MAPPER_SCALAR_PROJECTION_RHS); - KRATOS_REGISTER_VARIABLE(SCALAR_PROJECTED); - KRATOS_REGISTER_VARIABLE(FICTITIOUS_FLUID_DENSITY); - KRATOS_REGISTER_VARIABLE(FSI_INTERFACE_RESIDUAL_NORM); - KRATOS_REGISTER_VARIABLE(FSI_INTERFACE_MESH_RESIDUAL_NORM); - -// KRATOS_REGISTER_VARIABLE(PRESSURE_OLD_IT) -// KRATOS_REGISTER_VARIABLE(IS_INTERFACE); - - KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(MAPPER_VECTOR_PROJECTION_RHS); - KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(VAUX_EQ_TRACTION); - KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(VECTOR_PROJECTED); - KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(RELAXED_DISP); - KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(FSI_INTERFACE_RESIDUAL); - KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(FSI_INTERFACE_MESH_RESIDUAL); - KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(POSITIVE_MAPPED_VECTOR_VARIABLE); - KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(NEGATIVE_MAPPED_VECTOR_VARIABLE); - } } // namespace Kratos. diff --git a/applications/FSIapplication/fsi_application.h b/applications/FSIapplication/fsi_application.h index a2efed68b68b..642d13082e0e 100644 --- a/applications/FSIapplication/fsi_application.h +++ b/applications/FSIapplication/fsi_application.h @@ -24,6 +24,7 @@ #include "includes/define.h" #include "includes/kratos_application.h" #include "includes/variables.h" +#include "includes/fsi_variables.h" namespace Kratos @@ -32,25 +33,6 @@ namespace Kratos ///@name Kratos Globals ///@{ -// Variables definition -KRATOS_DEFINE_VARIABLE(int, CONVERGENCE_ACCELERATOR_ITERATION) -KRATOS_DEFINE_VARIABLE(double, MAPPER_SCALAR_PROJECTION_RHS) -KRATOS_DEFINE_VARIABLE(double, SCALAR_PROJECTED) -KRATOS_DEFINE_VARIABLE(double, FICTITIOUS_FLUID_DENSITY) -KRATOS_DEFINE_VARIABLE(double, FSI_INTERFACE_RESIDUAL_NORM) -KRATOS_DEFINE_VARIABLE(double, FSI_INTERFACE_MESH_RESIDUAL_NORM) -// KRATOS_DEFINE_VARIABLE(double, PRESSURE_OLD_IT) -// KRATOS_DEFINE_VARIABLE(double, IS_INTERFACE) - -KRATOS_DEFINE_3D_VARIABLE_WITH_COMPONENTS(MAPPER_VECTOR_PROJECTION_RHS) -KRATOS_DEFINE_3D_VARIABLE_WITH_COMPONENTS(VAUX_EQ_TRACTION) -KRATOS_DEFINE_3D_VARIABLE_WITH_COMPONENTS(VECTOR_PROJECTED) -KRATOS_DEFINE_3D_VARIABLE_WITH_COMPONENTS(RELAXED_DISP) -KRATOS_DEFINE_3D_VARIABLE_WITH_COMPONENTS(FSI_INTERFACE_RESIDUAL) -KRATOS_DEFINE_3D_VARIABLE_WITH_COMPONENTS(FSI_INTERFACE_MESH_RESIDUAL) -KRATOS_DEFINE_3D_VARIABLE_WITH_COMPONENTS(POSITIVE_MAPPED_VECTOR_VARIABLE) -KRATOS_DEFINE_3D_VARIABLE_WITH_COMPONENTS(NEGATIVE_MAPPED_VECTOR_VARIABLE) - class KratosFSIApplication : public KratosApplication { public: diff --git a/applications/FSIapplication/python_scripts/convergence_accelerator_factory.py b/applications/FSIapplication/python_scripts/convergence_accelerator_factory.py index 01d5049d9fe1..979108370b6e 100644 --- a/applications/FSIapplication/python_scripts/convergence_accelerator_factory.py +++ b/applications/FSIapplication/python_scripts/convergence_accelerator_factory.py @@ -2,52 +2,47 @@ import KratosMultiphysics import KratosMultiphysics.FSIApplication as KratosFSI +try: + import KratosMultiphysics.TrilinosApplication as KratosTrilinos + have_trilinos = True +except ImportError: + have_trilinos = False def CreateConvergenceAccelerator(configuration): - + if(type(configuration) != KratosMultiphysics.Parameters): raise Exception("Input is expected to be provided as a Kratos Parameters object.") - + convergence_accelerator_type = configuration["solver_type"].GetString() - + if(convergence_accelerator_type == "Relaxation"): - - defaults_relaxation = KratosMultiphysics.Parameters("""{ - "solver_type" : "Relaxation", - "acceleration_type" : "Aitken", - "w_0" : 0.825 - }""") - - configuration.ValidateAndAssignDefaults(defaults_relaxation) - - if (configuration["acceleration_type"].GetString() == "Aitken"): - convergence_accelerator = KratosFSI.AitkenConvergenceAccelerator(configuration["w_0"].GetDouble()) - + return KratosFSI.AitkenConvergenceAccelerator(configuration) + elif(convergence_accelerator_type == "MVQN"): - - defaults_MVQN = KratosMultiphysics.Parameters("""{ - "solver_type" : "MVQN", - "w_0" : 0.825 - }""") - - configuration.ValidateAndAssignDefaults(defaults_MVQN) - - convergence_accelerator = KratosFSI.MVQNFullJacobianConvergenceAccelerator(configuration["w_0"].GetDouble()) - + return KratosFSI.MVQNFullJacobianConvergenceAccelerator(configuration) + elif(convergence_accelerator_type == "MVQN_recursive"): - - defaults_MVQN_recursive = KratosMultiphysics.Parameters("""{ - "solver_type" : "MVQN_recursive", - "w_0" : 0.825, - "buffer_size" : 7 - }""") - - configuration.ValidateAndAssignDefaults(defaults_MVQN_recursive) - - convergence_accelerator = KratosFSI.MVQNRecursiveJacobianConvergenceAccelerator(configuration["w_0"].GetDouble(), - configuration["buffer_size"].GetInt()) - + return KratosFSI.MVQNRecursiveJacobianConvergenceAccelerator(configuration) + else: raise Exception("Convergence accelerator not found. Asking for : " + convergence_accelerator_type) return convergence_accelerator + +def CreateTrilinosConvergenceAccelerator(configuration): + + if(type(configuration) != KratosMultiphysics.Parameters): + raise Exception("Input is expected to be provided as a Kratos Parameters object.") + + if not have_trilinos: + raise Exception("Trying to create a Trilinos convergence accelerator, but TrilinosApplication could not be found.") + + convergence_accelerator_type = configuration["solver_type"].GetString() + + if(convergence_accelerator_type == "Relaxation"): + return KratosTrilinos.TrilinosAitkenConvergenceAccelerator(configuration) + + else: + raise Exception("Trilinos convergence accelerator not found. Asking for : " + convergence_accelerator_type) + + return convergence_accelerator diff --git a/applications/FSIapplication/python_scripts/partitioned_fsi_base_solver.py b/applications/FSIapplication/python_scripts/partitioned_fsi_base_solver.py index 401d823448ba..47cafe1a4abe 100644 --- a/applications/FSIapplication/python_scripts/partitioned_fsi_base_solver.py +++ b/applications/FSIapplication/python_scripts/partitioned_fsi_base_solver.py @@ -36,7 +36,6 @@ def __init__(self, structure_main_model_part, fluid_main_model_part, project_par if end_time_structure != end_time_fluid: raise("ERROR: Different final time among subdomains!") - #TODO: shall obtain the compute_model_part from the MODEL once the object is implemented self.structure_main_model_part = structure_main_model_part self.fluid_main_model_part = fluid_main_model_part @@ -45,55 +44,53 @@ def __init__(self, structure_main_model_part, fluid_main_model_part, project_par { "structure_solver_settings": { - "solver_type": "structural_mechanics_implicit_dynamic_solver", - "model_import_settings": { - "input_type": "mdpa", - "input_filename": "unknown_name" + "solver_type" : "structural_mechanics_implicit_dynamic_solver", + "model_import_settings" : { + "input_type" : "mdpa", + "input_filename" : "unknown_name" }, "material_import_settings" :{ - "materials_filename": "materials.json" + "materials_filename" : "materials.json" }, - "echo_level": 0, - "time_integration_method": "Implicit", - "analysis_type": "nonlinear", - "rotation_dofs": false, - "pressure_dofs": false, - "stabilization_factor": 1.0, - "reform_dofs_at_each_step": false, - "line_search": false, - "compute_reactions": true, - "compute_contact_forces": false, - "block_builder": false, - "move_mesh_flag": true, - "solution_type": "Dynamic", - "scheme_type": "Newmark", - "convergence_criterion": "Residual_criteria", + "echo_level" : 0, + "time_integration_method" : "Implicit", + "analysis_type" : "nonlinear", + "rotation_dofs" : false, + "pressure_dofs" : false, + "reform_dofs_at_each_step" : false, + "line_search" : false, + "compute_reactions" : true, + "compute_contact_forces" : false, + "block_builder" : true, + "move_mesh_flag" : true, + "solution_type" : "Dynamic", + "scheme_type" : "Newmark", + "convergence_criterion" : "Residual_criteria", "displacement_relative_tolerance" : 1.0e-3, "displacement_absolute_tolerance" : 1.0e-5, "residual_relative_tolerance" : 1.0e-3, "residual_absolute_tolerance" : 1.0e-5, - "max_iteration": 10, - "linear_solver_settings":{ + "max_iteration" : 10, + "linear_solver_settings" :{ "solver_type" : "SuperLUSolver", "max_iteration" : 200, "tolerance" : 1e-7, "scaling" : false, "verbosity" : 1 }, - "processes_sub_model_part_list": [""], - "problem_domain_sub_model_part_list": ["solid_model_part"] + "processes_sub_model_part_list" : [""], + "problem_domain_sub_model_part_list" : ["solid_model_part"] }, - "fluid_solver_settings": - { - "solver_type": "navier_stokes_solver_vmsmonolithic", - "model_import_settings": { - "input_type": "mdpa", - "input_filename": "unknown_name" + "fluid_solver_settings": { + "solver_type" : "navier_stokes_solver_vmsmonolithic", + "model_import_settings" : { + "input_type" : "mdpa", + "input_filename" : "unknown_name" }, - "maximum_iterations": 10, - "dynamic_tau" : 0.0, - "oss_switch" : 0, - "echo_level" : 0, + "maximum_iterations" : 10, + "dynamic_tau" : 0.0, + "oss_switch" : 0, + "echo_level" : 0, "consider_periodic_conditions" : false, "compute_reactions" : true, "divergence_clearance_steps" : 0, @@ -102,7 +99,7 @@ def __init__(self, structure_main_model_part, fluid_main_model_part, project_par "absolute_velocity_tolerance" : 1e-5, "relative_pressure_tolerance" : 1e-3, "absolute_pressure_tolerance" : 1e-5, - "linear_solver_settings" : { + "linear_solver_settings" : { "solver_type" : "AMGCL", "max_iteration" : 200, "tolerance" : 1e-9, @@ -128,20 +125,19 @@ def __init__(self, structure_main_model_part, fluid_main_model_part, project_par }, "coupling_solver_settings": { - "coupling_scheme" : "DirichletNeumann", - "solver_type" : "partitioned_fsi_solver", - "nl_tol" : 1e-5, - "nl_max_it" : 50, - "solve_mesh_at_each_iteration" : true, + "coupling_scheme" : "DirichletNeumann", + "solver_type" : "partitioned_fsi_solver", + "nl_tol" : 1e-5, + "nl_max_it" : 50, + "solve_mesh_at_each_iteration" : true, "coupling_strategy" : { "solver_type" : "Relaxation", "acceleration_type" : "Aitken", "w_0" : 0.825 }, - "mesh_solver" : "mesh_solver_structural_similarity", - "mesh_reform_dofs_each_step" : false, - "structure_interfaces_list" : [""], - "fluid_interfaces_list" : [""] + "mesh_solver" : "mesh_solver_structural_similarity", + "structure_interfaces_list" : [""], + "fluid_interfaces_list" : [""] }, "mapper_settings" : [{ "mapper_face" : "Unique", @@ -201,7 +197,6 @@ def __init__(self, structure_main_model_part, fluid_main_model_part, project_par # Construct the ALE mesh solver mesh_solver_settings = KratosMultiphysics.Parameters("{}") - mesh_solver_settings.AddValue("mesh_reform_dofs_each_step",self.settings["coupling_solver_settings"]["mesh_reform_dofs_each_step"]) self.mesh_solver_module = __import__(self.settings["coupling_solver_settings"]["mesh_solver"].GetString()) self.mesh_solver = self.mesh_solver_module.CreateSolver(self.fluid_solver.main_model_part, @@ -216,7 +211,7 @@ def GetMinimumBufferSize(self): # Get fluid buffer size buffer_fluid = self.fluid_solver.GetMinimumBufferSize() - return min(buffer_structure,buffer_fluid) + return max(buffer_structure,buffer_fluid) def AddVariables(self): @@ -228,18 +223,18 @@ def AddVariables(self): # Standard CFD variables addition self.fluid_solver.AddVariables() self.fluid_solver.main_model_part.AddNodalSolutionStepVariable(KratosMultiphysics.FORCE) - self.fluid_solver.main_model_part.AddNodalSolutionStepVariable(KratosMultiphysics.DISPLACEMENT) + self.fluid_solver.main_model_part.AddNodalSolutionStepVariable(KratosMultiphysics.MESH_ACCELERATION) # TODO: This should be added in the mesh solvers # Mesh solver variables addition self.mesh_solver.AddVariables() ## FSIApplication variables addition NonConformant_OneSideMap.AddVariables(self.fluid_solver.main_model_part,self.structure_solver.main_model_part) - self.fluid_solver.main_model_part.AddNodalSolutionStepVariable(KratosFSI.VECTOR_PROJECTED) - self.fluid_solver.main_model_part.AddNodalSolutionStepVariable(KratosFSI.FSI_INTERFACE_RESIDUAL) - self.fluid_solver.main_model_part.AddNodalSolutionStepVariable(KratosFSI.FSI_INTERFACE_MESH_RESIDUAL) - self.structure_solver.main_model_part.AddNodalSolutionStepVariable(KratosFSI.POSITIVE_MAPPED_VECTOR_VARIABLE) - self.structure_solver.main_model_part.AddNodalSolutionStepVariable(KratosFSI.NEGATIVE_MAPPED_VECTOR_VARIABLE) - self.structure_solver.main_model_part.AddNodalSolutionStepVariable(KratosFSI.VECTOR_PROJECTED) + self.fluid_solver.main_model_part.AddNodalSolutionStepVariable(KratosMultiphysics.VECTOR_PROJECTED) + self.fluid_solver.main_model_part.AddNodalSolutionStepVariable(KratosMultiphysics.FSI_INTERFACE_RESIDUAL) + self.fluid_solver.main_model_part.AddNodalSolutionStepVariable(KratosMultiphysics.FSI_INTERFACE_MESH_RESIDUAL) + self.structure_solver.main_model_part.AddNodalSolutionStepVariable(KratosMultiphysics.POSITIVE_MAPPED_VECTOR_VARIABLE) + self.structure_solver.main_model_part.AddNodalSolutionStepVariable(KratosMultiphysics.NEGATIVE_MAPPED_VECTOR_VARIABLE) + self.structure_solver.main_model_part.AddNodalSolutionStepVariable(KratosMultiphysics.VECTOR_PROJECTED) def ImportModelPart(self): @@ -344,6 +339,14 @@ def _GetDomainSize(self): return fluid_domain_size + def _GetNodalUpdateUtilities(self): + + if (self.domain_size == 2): + return KratosFSI.NodalUpdateNewmark2D(self.settings["fluid_solver_settings"]["alpha"].GetDouble()) + else: + return KratosFSI.NodalUpdateNewmark3D(self.settings["fluid_solver_settings"]["alpha"].GetDouble()) + + def _GetPartitionedFSIUtilities(self): if (self.domain_size == 2): diff --git a/applications/FSIapplication/python_scripts/partitioned_fsi_dirichlet_neumann_solver.py b/applications/FSIapplication/python_scripts/partitioned_fsi_dirichlet_neumann_solver.py index 7784d760a732..4f034902fb51 100644 --- a/applications/FSIapplication/python_scripts/partitioned_fsi_dirichlet_neumann_solver.py +++ b/applications/FSIapplication/python_scripts/partitioned_fsi_dirichlet_neumann_solver.py @@ -36,6 +36,9 @@ def Initialize(self): # Get the domain size self.domain_size = self._GetDomainSize() + # Get the nodal update FSI utilities + self.nodal_update_utilities = self._GetNodalUpdateUtilities() + # Get the partitioned FSI utilities self.partitioned_fsi_utilities = self._GetPartitionedFSIUtilities() @@ -52,6 +55,9 @@ def Initialize(self): # Python mesh solver initialization self.mesh_solver.Initialize() + # Initialize the Dirichlet-Neumann interface + self._InitializeDirichletNeumannInterface() + # Construct the interface mapper self._SetUpMapper() @@ -61,9 +67,6 @@ def Initialize(self): # Initialize the iteration value vector self._InitializeIterationValueVector() - # Initialize the Dirichlet-Neumann interface - self._InitializeDirichletNeumannInterface() - # Compute the fluid domain NODAL_AREA values (required as weight in the residual norm computation) KratosMultiphysics.CalculateNodalAreaProcess(self.fluid_solver.GetComputingModelPart(), self.domain_size).Execute() @@ -89,21 +92,17 @@ def Solve(self): for nl_it in range(1,self.max_nl_it+1): print(" NL-ITERATION ",nl_it,"STARTS.") - self.fluid_solver.main_model_part.ProcessInfo[KratosFSI.CONVERGENCE_ACCELERATOR_ITERATION] = nl_it - self.structure_solver.main_model_part.ProcessInfo[KratosFSI.CONVERGENCE_ACCELERATOR_ITERATION] = nl_it + self.fluid_solver.main_model_part.ProcessInfo[KratosMultiphysics.CONVERGENCE_ACCELERATOR_ITERATION] = nl_it + self.structure_solver.main_model_part.ProcessInfo[KratosMultiphysics.CONVERGENCE_ACCELERATOR_ITERATION] = nl_it self.coupling_utility.InitializeNonLinearIteration() print(" Residual computation starts...") - # Sets self.iteration_value as MESH_DISPLACEMENT - # Solves the mesh problem - # Sets self.iteration_value derivatives as VELOCITY, ACCELERATION and MESH_VELOCITY - # Solves the fluid problem and computes the nodal fluxes (REACTION) - self._SolveMeshAndFluid() - # Sets the structure POINT_LOAD as the fluid interface REACTION - # Solves the structure problem + # Solve the mesh problem as well as the fluid problem + self._SolveMeshAndFluid() + # Solve the structure problem and computes the displacement residual if (self.double_faced_structure): self._SolveStructureDoubleFaced() dis_residual = self._ComputeDisplacementResidualDoubleFaced() @@ -112,25 +111,33 @@ def Solve(self): dis_residual = self._ComputeDisplacementResidualSingleFaced() # Residual computation - nl_res_norm = self.fluid_solver.main_model_part.ProcessInfo[KratosFSI.FSI_INTERFACE_RESIDUAL_NORM] + nl_res_norm = self.fluid_solver.main_model_part.ProcessInfo[KratosMultiphysics.FSI_INTERFACE_RESIDUAL_NORM] interface_dofs = self.partitioned_fsi_utilities.GetInterfaceResidualSize(self._GetFluidInterfaceSubmodelPart()) # Check convergence if nl_res_norm/math.sqrt(interface_dofs) < self.nl_tol: print(" NON-LINEAR ITERATION CONVERGENCE ACHIEVED") print(" Total non-linear iterations: ",nl_it," |res|/sqrt(Ndofs) = ",nl_res_norm/math.sqrt(interface_dofs)) + break else: # If convergence is not achieved, perform the correction of the prediction print(" Residual computation finished. |res|/sqrt(Ndofs) =", nl_res_norm/math.sqrt(interface_dofs)) print(" Performing non-linear iteration ",nl_it," correction.") - # self.coupling_utility.UpdateSolution(vel_residual, self.iteration_value) self.coupling_utility.UpdateSolution(dis_residual, self.iteration_value) - self.coupling_utility.FinalizeNonLinearIteration() + + if (nl_it == self.max_nl_it): + print("***********************************************************") + print("***********************************************************") + print(" NON-LINEAR ITERATION CONVERGENCE NOT ACHIEVED ") + print("***********************************************************") + print("***********************************************************") + + self.coupling_utility.FinalizeNonLinearIteration() ## Compute the mesh residual as final testing (it is expected to be 0) self.partitioned_fsi_utilities.ComputeFluidInterfaceMeshVelocityResidualNorm(self._GetFluidInterfaceSubmodelPart()) - mesh_res_norm = self.fluid_solver.main_model_part.ProcessInfo.GetValue(KratosFSI.FSI_INTERFACE_MESH_RESIDUAL_NORM) + mesh_res_norm = self.fluid_solver.main_model_part.ProcessInfo.GetValue(KratosMultiphysics.FSI_INTERFACE_MESH_RESIDUAL_NORM) print(" NL residual norm: ", nl_res_norm) print(" Mesh residual norm: ", mesh_res_norm) @@ -154,13 +161,13 @@ def _InitializeIterationValueVector(self): def _InitializeDirichletNeumannInterface(self): - # Fix the VELOCITY, MESH_DISPLACEMENT and MESH_VELOCITY variables in all the fluid interface submodelparts - # TODO: This method allows to supress the set_interface_process + # Initialize Dirichlet fluid interface num_fl_interfaces = self.settings["coupling_solver_settings"]["fluid_interfaces_list"].size() for fl_interface_id in range(num_fl_interfaces): fl_interface_name = self.settings["coupling_solver_settings"]["fluid_interfaces_list"][fl_interface_id].GetString() fl_interface_submodelpart = self.fluid_solver.main_model_part.GetSubModelPart(fl_interface_name) + # Fix the VELOCITY, MESH_DISPLACEMENT and MESH_VELOCITY variables in all the fluid interface submodelparts KratosMultiphysics.VariableUtils().ApplyFixity(KratosMultiphysics.VELOCITY_X, True, fl_interface_submodelpart.Nodes) KratosMultiphysics.VariableUtils().ApplyFixity(KratosMultiphysics.VELOCITY_Y, True, fl_interface_submodelpart.Nodes) KratosMultiphysics.VariableUtils().ApplyFixity(KratosMultiphysics.MESH_VELOCITY_X, True, fl_interface_submodelpart.Nodes) @@ -172,16 +179,29 @@ def _InitializeDirichletNeumannInterface(self): KratosMultiphysics.VariableUtils().ApplyFixity(KratosMultiphysics.MESH_VELOCITY_Z, True, fl_interface_submodelpart.Nodes) KratosMultiphysics.VariableUtils().ApplyFixity(KratosMultiphysics.MESH_DISPLACEMENT_Z, True, fl_interface_submodelpart.Nodes) + # Set the interface flag + KratosMultiphysics.VariableUtils().SetFlag(KratosMultiphysics.INTERFACE, True, fl_interface_submodelpart.Nodes) + + # Initialize Neumann structure interface + num_str_interfaces = self.settings["coupling_solver_settings"]["structure_interfaces_list"].size() + for str_interface_id in range(num_str_interfaces): + str_interface_name = self.settings["coupling_solver_settings"]["structure_interfaces_list"][str_interface_id].GetString() + str_interface_submodelpart = self.structure_solver.main_model_part.GetSubModelPart(str_interface_name) + + # Set the interface flag + KratosMultiphysics.VariableUtils().SetFlag(KratosMultiphysics.INTERFACE, True, str_interface_submodelpart.Nodes) def _SolveMeshAndFluid(self): - # Set the mesh displacement as the iteration_value displacement + # Set the iteration_value displacement as MESH_DISPLACEMENT num_fl_interfaces = self.settings["coupling_solver_settings"]["fluid_interfaces_list"].size() for fl_interface_id in range(num_fl_interfaces): fl_interface_name = self.settings["coupling_solver_settings"]["fluid_interfaces_list"][fl_interface_id].GetString() fl_interface_submodelpart = self.fluid_solver.main_model_part.GetSubModelPart(fl_interface_name) - self.partitioned_fsi_utilities.SetInterfaceVectorVariable(fl_interface_submodelpart, KratosMultiphysics.MESH_DISPLACEMENT, self.iteration_value) + self.partitioned_fsi_utilities.UpdateInterfaceValues(fl_interface_submodelpart, + KratosMultiphysics.MESH_DISPLACEMENT, + self.iteration_value) # Solve the mesh problem (or moves the interface nodes) if (self.solve_mesh_at_each_iteration == True): @@ -189,11 +209,11 @@ def _SolveMeshAndFluid(self): else: self.mesh_solver.MoveNodes() - # Fluid domain velocities imposition - # Compute the velocity associated to the iteration_value displacement and set it to VELOCITY and MESH_VELOCITY - # Note that the VELOCITY and the MESH_VELOCITY values only coincide if the same time schemes are used - # Currently, the mesh solver only includes the BDF2 so the MESH_VELOCITY values are forced to be the fluid ones - self._ComputeCorrectedInterfaceDisplacementDerivatives() + # Update MESH_VELOCITY and MESH_ACCELERATION with Newmark formulas + self.nodal_update_utilities.UpdateMeshTimeDerivatives(self.fluid_main_model_part, self.time_step) + + # Impose the structure MESH_VELOCITY and MESH_ACCELERATION in the fluid interface VELOCITY and ACCELERATION + self.nodal_update_utilities.UpdateTimeDerivativesOnInterface(self._GetFluidInterfaceSubmodelPart()) # Solve fluid problem self.fluid_solver.SolveSolutionStep() @@ -219,19 +239,19 @@ def _SolveStructureDoubleFaced(self): keep_sign = False distribute_load = True self.interface_mapper.PositiveFluidToStructure_VectorMap(KratosMultiphysics.REACTION, - KratosFSI.POSITIVE_MAPPED_VECTOR_VARIABLE, + KratosMultiphysics.POSITIVE_MAPPED_VECTOR_VARIABLE, keep_sign, distribute_load) self.interface_mapper.NegativeFluidToStructure_VectorMap(KratosMultiphysics.REACTION, - KratosFSI.NEGATIVE_MAPPED_VECTOR_VARIABLE, + KratosMultiphysics.NEGATIVE_MAPPED_VECTOR_VARIABLE, keep_sign, distribute_load) # Add the two faces contributions to the POINT_LOAD variable # TODO: Add this to the variables utils for node in self._GetStructureInterfaceSubmodelPart().Nodes: - pos_face_force = node.GetSolutionStepValue(KratosFSI.POSITIVE_MAPPED_VECTOR_VARIABLE) - neg_face_force = node.GetSolutionStepValue(KratosFSI.NEGATIVE_MAPPED_VECTOR_VARIABLE) + pos_face_force = node.GetSolutionStepValue(KratosMultiphysics.POSITIVE_MAPPED_VECTOR_VARIABLE) + neg_face_force = node.GetSolutionStepValue(KratosMultiphysics.NEGATIVE_MAPPED_VECTOR_VARIABLE) node.SetSolutionStepValue(KratosStructural.POINT_LOAD, 0, pos_face_force+neg_face_force) # Solve the structure problem @@ -243,14 +263,14 @@ def _ComputeDisplacementResidualSingleFaced(self): keep_sign = True distribute_load = False self.interface_mapper.StructureToFluid_VectorMap(KratosMultiphysics.DISPLACEMENT, - KratosFSI.VECTOR_PROJECTED, + KratosMultiphysics.VECTOR_PROJECTED, keep_sign, distribute_load) # Compute the fluid interface residual vector by means of the VECTOR_PROJECTED variable # Besides, its norm is stored within the ProcessInfo. disp_residual = KratosMultiphysics.Vector(self.partitioned_fsi_utilities.GetInterfaceResidualSize(self._GetFluidInterfaceSubmodelPart())) - self.partitioned_fsi_utilities.ComputeInterfaceVectorResidual(self._GetFluidInterfaceSubmodelPart(), KratosMultiphysics.MESH_DISPLACEMENT, KratosFSI.VECTOR_PROJECTED, disp_residual) + self.partitioned_fsi_utilities.ComputeInterfaceVectorResidual(self._GetFluidInterfaceSubmodelPart(), KratosMultiphysics.MESH_DISPLACEMENT, KratosMultiphysics.VECTOR_PROJECTED, disp_residual) return disp_residual @@ -263,11 +283,11 @@ def _ComputeDisplacementResidualDoubleFaced(self): # the _GetFluidInterfaceSubmodelPart(), which is the one used to compute the interface residual, # gets the structure DISPLACEMENT. Think a way to properly identify the reference fluid interface. self.interface_mapper.StructureToPositiveFluid_VectorMap(KratosMultiphysics.DISPLACEMENT, - KratosFSI.VECTOR_PROJECTED, + KratosMultiphysics.VECTOR_PROJECTED, keep_sign, distribute_load) self.interface_mapper.StructureToNegativeFluid_VectorMap(KratosMultiphysics.DISPLACEMENT, - KratosFSI.VECTOR_PROJECTED, + KratosMultiphysics.VECTOR_PROJECTED, keep_sign, distribute_load) @@ -277,67 +297,3 @@ def _ComputeDisplacementResidualDoubleFaced(self): self.partitioned_fsi_utilities.ComputeInterfaceVectorResidual(self._GetFluidInterfaceSubmodelPart(), KratosMultiphysics.MESH_DISPLACEMENT, KratosFSI.VECTOR_PROJECTED, disp_residual) return disp_residual - - - ### INTERFACE MOVEMENT UTILITY ### - # Function to update the velocity and acceleration according to the displacement in self.iteration_value. - # Note that at the moment only the Bossak scheme is considered - def _ComputeCorrectedInterfaceDisplacementDerivatives(self): - - # Bossak parameters - alpha = self.settings["fluid_solver_settings"]["alpha"].GetDouble() - gamma = 0.5*(1-2*alpha) - beta = ((1-alpha)**2)/4 - - i = 0 - if (self.domain_size == 2): - for node in self._GetFluidInterfaceSubmodelPart().Nodes: - u_n = node.GetSolutionStepValue(KratosMultiphysics.MESH_DISPLACEMENT,1) - v_n = node.GetSolutionStepValue(KratosMultiphysics.VELOCITY,1) - a_n = node.GetSolutionStepValue(KratosMultiphysics.ACCELERATION,1) - - u_n1 = KratosMultiphysics.Vector(3) - u_n1[0] = self.iteration_value[i] - u_n1[1] = self.iteration_value[i+1] - u_n1[2] = 0.0 - i+=2 - - a_n1 = KratosMultiphysics.Vector(3) - a_n1[0] = (u_n1[0] - u_n[0] - self.time_step*v_n[0] - (self.time_step**2)*(0.5-beta+beta*alpha)*a_n[0])/((self.time_step**2)*beta*(1-alpha)) - a_n1[1] = (u_n1[1] - u_n[1] - self.time_step*v_n[1] - (self.time_step**2)*(0.5-beta+beta*alpha)*a_n[1])/((self.time_step**2)*beta*(1-alpha)) - a_n1[2] = 0.0 - - v_n1 = KratosMultiphysics.Vector(3) - v_n1[0] = v_n[0] + self.time_step*(1-gamma)*a_n[0] + self.time_step*gamma*(1-alpha)*a_n1[0] + self.time_step*gamma*alpha*a_n[0] - v_n1[1] = v_n[1] + self.time_step*(1-gamma)*a_n[1] + self.time_step*gamma*(1-alpha)*a_n1[1] + self.time_step*gamma*alpha*a_n[1] - v_n1[2] = 0.0 - - node.SetSolutionStepValue(KratosMultiphysics.VELOCITY,0,v_n1) - node.SetSolutionStepValue(KratosMultiphysics.MESH_VELOCITY,0,v_n1) - node.SetSolutionStepValue(KratosMultiphysics.ACCELERATION,0,a_n1) - - else: - for node in self._GetFluidInterfaceSubmodelPart().Nodes: - u_n = node.GetSolutionStepValue(KratosMultiphysics.MESH_DISPLACEMENT,1) - v_n = node.GetSolutionStepValue(KratosMultiphysics.VELOCITY,1) - a_n = node.GetSolutionStepValue(KratosMultiphysics.ACCELERATION,1) - - u_n1 = KratosMultiphysics.Vector(3) - u_n1[0] = self.iteration_value[i] - u_n1[1] = self.iteration_value[i+1] - u_n1[2] = self.iteration_value[i+2] - i+=3 - - a_n1 = KratosMultiphysics.Vector(3) - a_n1[0] = (u_n1[0] - u_n[0] - self.time_step*v_n[0] - (self.time_step**2)*(0.5-beta+beta*alpha)*a_n[0])/((self.time_step**2)*beta*(1-alpha)) - a_n1[1] = (u_n1[1] - u_n[1] - self.time_step*v_n[1] - (self.time_step**2)*(0.5-beta+beta*alpha)*a_n[1])/((self.time_step**2)*beta*(1-alpha)) - a_n1[2] = (u_n1[2] - u_n[2] - self.time_step*v_n[2] - (self.time_step**2)*(0.5-beta+beta*alpha)*a_n[2])/((self.time_step**2)*beta*(1-alpha)) - - v_n1 = KratosMultiphysics.Vector(3) - v_n1[0] = v_n[0] + self.time_step*(1-gamma)*a_n[0] + self.time_step*gamma*(1-alpha)*a_n1[0] + self.time_step*gamma*alpha*a_n[0] - v_n1[1] = v_n[1] + self.time_step*(1-gamma)*a_n[1] + self.time_step*gamma*(1-alpha)*a_n1[1] + self.time_step*gamma*alpha*a_n[1] - v_n1[2] = v_n[2] + self.time_step*(1-gamma)*a_n[2] + self.time_step*gamma*(1-alpha)*a_n1[2] + self.time_step*gamma*alpha*a_n[2] - - node.SetSolutionStepValue(KratosMultiphysics.VELOCITY,0,v_n1) - node.SetSolutionStepValue(KratosMultiphysics.MESH_VELOCITY,0,v_n1) - node.SetSolutionStepValue(KratosMultiphysics.ACCELERATION,0,a_n1) diff --git a/applications/FSIapplication/python_scripts/trilinos_partitioned_fsi_base_solver.py b/applications/FSIapplication/python_scripts/trilinos_partitioned_fsi_base_solver.py new file mode 100644 index 000000000000..22ced854f909 --- /dev/null +++ b/applications/FSIapplication/python_scripts/trilinos_partitioned_fsi_base_solver.py @@ -0,0 +1,359 @@ +from __future__ import print_function, absolute_import, division # makes KratosMultiphysics backward compatible with python 2.6 and 2.7 + +# Import utilities +import python_solvers_wrapper_fluid # Import the fluid Python solvers wrapper +import python_solvers_wrapper_structural # Import the structure Python solvers wrapper + +# Import kratos core and applications +import KratosMultiphysics +import KratosMultiphysics.mpi as KratosMPI +import KratosMultiphysics.MetisApplication as KratosMetis +import KratosMultiphysics.TrilinosApplication as KratosTrilinos +import KratosMultiphysics.ALEApplication as KratosALE +import KratosMultiphysics.MappingApplication as KratosMapping +import KratosMultiphysics.FSIApplication as KratosFSI +import KratosMultiphysics.FluidDynamicsApplication as KratosFluid +import KratosMultiphysics.StructuralMechanicsApplication as KratosStructural + +# Check that KratosMultiphysics was imported in the main script +KratosMultiphysics.CheckForPreviousImport() + +## Import base class file +import partitioned_fsi_base_solver + + +def CreateSolver(structure_main_model_part, fluid_main_model_part, project_parameters): + return TrilinosPartitionedFSIBaseSolver(structure_main_model_part, fluid_main_model_part, project_parameters) + + +class TrilinosPartitionedFSIBaseSolver(partitioned_fsi_base_solver.PartitionedFSIBaseSolver): + def __init__(self, structure_main_model_part, fluid_main_model_part, project_parameters): + + if (KratosMPI.mpi.rank == 0) : print("** Calling the partitioned FSI Trilinos base solver constructor...") + + # Initial tests + start_time_structure = project_parameters["structure_solver_settings"]["problem_data"]["start_time"].GetDouble() + start_time_fluid = project_parameters["fluid_solver_settings"]["problem_data"]["start_time"].GetDouble() + end_time_structure = project_parameters["structure_solver_settings"]["problem_data"]["end_time"].GetDouble() + end_time_fluid = project_parameters["fluid_solver_settings"]["problem_data"]["end_time"].GetDouble() + + if start_time_structure != start_time_fluid: + if (KratosMPI.mpi.rank == 0) : raise("ERROR: Different initial time among subdomains!") + if end_time_structure != end_time_fluid: + if (KratosMPI.mpi.rank == 0) : raise("ERROR: Different final time among subdomains!") + + self.structure_main_model_part = structure_main_model_part + self.fluid_main_model_part = fluid_main_model_part + + # Settings string in JSON format + default_settings = KratosMultiphysics.Parameters(""" + { + "structure_solver_settings": + { + "solver_type" : "trilinos_structural_mechanics_implicit_dynamic_solver", + "model_import_settings" : { + "input_type" : "mdpa", + "input_filename" : "unknown_name" + }, + "material_import_settings" :{ + "materials_filename" : "materials.json" + }, + "echo_level" : 0, + "time_integration_method" : "Implicit", + "analysis_type" : "nonlinear", + "rotation_dofs" : false, + "pressure_dofs" : false, + "reform_dofs_at_each_step" : false, + "line_search" : false, + "compute_reactions" : true, + "compute_contact_forces" : false, + "block_builder" : true, + "move_mesh_flag" : true, + "solution_type" : "Dynamic", + "scheme_type" : "Newmark", + "convergence_criterion" : "Residual_criteria", + "displacement_relative_tolerance" : 1.0e-3, + "displacement_absolute_tolerance" : 1.0e-5, + "residual_relative_tolerance" : 1.0e-3, + "residual_absolute_tolerance" : 1.0e-5, + "max_iteration" : 10, + "linear_solver_settings" :{ + "solver_type" : "Klu", + "scaling" : false + }, + "processes_sub_model_part_list" : [""], + "problem_domain_sub_model_part_list" : [""] + }, + "fluid_solver_settings" : { + "solver_type" : "Monolithic", + "model_import_settings" : { + "input_type" : "mdpa", + "input_filename" : "unknown_name" + }, + "maximum_iterations" : 10, + "dynamic_tau" : 0.01, + "oss_switch" : 0, + "echo_level" : 0, + "consider_periodic_conditions" : false, + "compute_reactions" : true, + "divergence_clearance_steps" : 0, + "reform_dofs_at_each_step" : true, + "relative_velocity_tolerance" : 1e-3, + "absolute_velocity_tolerance" : 1e-5, + "relative_pressure_tolerance" : 1e-3, + "absolute_pressure_tolerance" : 1e-5, + "linear_solver_settings" : { + "solver_type" : "MultiLevelSolver", + "max_iteration" : 200, + "tolerance" : 1e-8, + "max_levels" : 3, + "symmetric" : false, + "reform_preconditioner_at_each_step" : true, + "scaling" : true + }, + "volume_model_part_name" : "volume_model_part", + "skin_parts" : [""], + "no_skin_parts" : [""], + "time_stepping" : { + "automatic_time_step" : false, + "time_step" : 0.1 + }, + "alpha" :-0.3, + "move_mesh_strategy" : 0, + "periodic" : "periodic", + "move_mesh_flag" : false, + "turbulence_model" : "None" + }, + "coupling_solver_settings": { + "coupling_scheme" : "DirichletNeumann", + "solver_type" : "trilinos_partitioned_fsi_solver", + "nl_tol" : 1e-5, + "nl_max_it" : 50, + "solve_mesh_at_each_iteration" : true, + "coupling_strategy" : { + "solver_type" : "Relaxation", + "acceleration_type" : "Aitken", + "w_0" : 0.825 + }, + "mesh_solver" : "trilinos_mesh_solver_structural_similarity", + "mesh_reform_dofs_each_step" : false, + "structure_interfaces_list" : [""], + "fluid_interfaces_list" : [""] + }, + "mapper_settings" : [{ + "mapper_face" : "Unique", + "positive_fluid_interface_submodelpart_name" : "Default_interface_submodelpart_name", + "structure_interface_submodelpart_name" : "Default_interface_submodelpart_name" + }] + } + """) + + # Time stepping checks (no sub-stepping between subdomains has been implemented yed) + time_step_structure = project_parameters["structure_solver_settings"]["problem_data"]["time_step"].GetDouble() + # If automatic time stepping has been selected in the fluid domain, deactivate it and use the structure time step + if (project_parameters["fluid_solver_settings"]["solver_settings"]["time_stepping"]["automatic_time_step"].GetBool()): + project_parameters["fluid_solver_settings"]["solver_settings"]["time_stepping"]["automatic_time_step"].SetBool(False) + time_step_fluid = time_step_structure + if (KratosMPI.mpi.rank == 0) : print("WARNING: Automatic fluid time stepping cannot be used. Setting structure time step as fluid time step.") + else: + time_step_fluid = project_parameters["fluid_solver_settings"]["solver_settings"]["time_stepping"]["time_step"].GetDouble() + if time_step_structure != time_step_fluid: + if (KratosMPI.mpi.rank == 0) : raise("ERROR: Different time step among subdomains! No sub-stepping implemented yet.") + + self.time_step = time_step_fluid + + # Take the each one of the solvers settings from the ProjectParameters + self.settings = KratosMultiphysics.Parameters("{}") + self.settings.AddValue("structure_solver_settings",project_parameters["structure_solver_settings"]["solver_settings"]) + self.settings.AddValue("fluid_solver_settings",project_parameters["fluid_solver_settings"]["solver_settings"]) + self.settings.AddValue("coupling_solver_settings",project_parameters["coupling_solver_settings"]["solver_settings"]) + self.settings.AddValue("mapper_settings",project_parameters["coupling_solver_settings"]["mapper_settings"]) + + # Overwrite the default settings with user-provided parameters + self.settings.RecursivelyValidateAndAssignDefaults(default_settings) + + # Auxiliar variables + self.max_nl_it = self.settings["coupling_solver_settings"]["nl_max_it"].GetInt() + self.nl_tol = self.settings["coupling_solver_settings"]["nl_tol"].GetDouble() + self.solve_mesh_at_each_iteration = self.settings["coupling_solver_settings"]["solve_mesh_at_each_iteration"].GetBool() + self.coupling_algorithm = self.settings["coupling_solver_settings"]["coupling_scheme"].GetString() + self.fluid_interface_submodelpart_name = self.settings["coupling_solver_settings"]["fluid_interfaces_list"][0].GetString() + self.structure_interface_submodelpart_name = self.settings["coupling_solver_settings"]["structure_interfaces_list"][0].GetString() + coupling_utility_parameters = self.settings["coupling_solver_settings"]["coupling_strategy"] + + # Construct the structure solver + self.structure_solver = python_solvers_wrapper_structural.CreateSolver(self.structure_main_model_part, + project_parameters["structure_solver_settings"]) + if (KratosMPI.mpi.rank == 0) : print("* Structure solver constructed.") + + # Construct the fluid solver + self.fluid_solver = python_solvers_wrapper_fluid.CreateSolver(self.fluid_main_model_part, + project_parameters["fluid_solver_settings"]) + if (KratosMPI.mpi.rank == 0) : print("* Fluid solver constructed.") + + # Construct the coupling partitioned strategy + import convergence_accelerator_factory + self.coupling_utility = convergence_accelerator_factory.CreateTrilinosConvergenceAccelerator(coupling_utility_parameters) + if (KratosMPI.mpi.rank == 0) : print("* Coupling strategy constructed.") + + # Construct the ALE mesh solver + mesh_solver_settings = KratosMultiphysics.Parameters("{}") + mesh_solver_settings.AddValue("mesh_reform_dofs_each_step",self.settings["coupling_solver_settings"]["mesh_reform_dofs_each_step"]) + + self.mesh_solver_module = __import__(self.settings["coupling_solver_settings"]["mesh_solver"].GetString()) + self.mesh_solver = self.mesh_solver_module.CreateSolver(self.fluid_solver.main_model_part, + mesh_solver_settings) + if (KratosMPI.mpi.rank == 0): + print("* ALE mesh solver constructed.") + print("** Partitioned FSI base solver constructed.") + + + def AddVariables(self): + ## Structure variables addition + # Standard CSM variables addition + self.structure_solver.AddVariables() + + ## Fluid variables addition + # Standard CFD variables addition + self.fluid_solver.AddVariables() + self.fluid_solver.main_model_part.AddNodalSolutionStepVariable(KratosMultiphysics.FORCE) + self.fluid_solver.main_model_part.AddNodalSolutionStepVariable(KratosMultiphysics.MESH_ACCELERATION) # TODO: This should be added in the mesh solvers + # Mesh solver variables addition + self.mesh_solver.AddVariables() + + ## FSIApplication variables addition + self.fluid_solver.main_model_part.AddNodalSolutionStepVariable(KratosMultiphysics.VECTOR_PROJECTED) + self.fluid_solver.main_model_part.AddNodalSolutionStepVariable(KratosMultiphysics.FSI_INTERFACE_RESIDUAL) + self.fluid_solver.main_model_part.AddNodalSolutionStepVariable(KratosMultiphysics.FSI_INTERFACE_MESH_RESIDUAL) + self.structure_solver.main_model_part.AddNodalSolutionStepVariable(KratosMultiphysics.POSITIVE_MAPPED_VECTOR_VARIABLE) + self.structure_solver.main_model_part.AddNodalSolutionStepVariable(KratosMultiphysics.NEGATIVE_MAPPED_VECTOR_VARIABLE) + self.structure_solver.main_model_part.AddNodalSolutionStepVariable(KratosMultiphysics.VECTOR_PROJECTED) + + + ####################################################################### + ############## PRIVATE METHODS SECTION ############## + ####################################################################### + + ### AUXILIAR METHODS ### + def _GetPartitionedFSIUtilities(self): + + if (self.domain_size == 2): + return KratosTrilinos.TrilinosPartitionedFSIUtilities2D(self.epetra_communicator) + else: + return KratosTrilinos.TrilinosPartitionedFSIUtilities3D(self.epetra_communicator) + + ### TODO: SUBSTITUTE IN THIS METHOD THE OLD MAPPER BY THE ONE IN THE FSI APPLICATION + def _SetUpMapper(self): + + + if (self.settings["mapper_settings"].size() == 1): + fluid_submodelpart_name = self.settings["mapper_settings"][0]["fluid_interface_submodelpart_name"].GetString() + structure_submodelpart_name = self.settings["mapper_settings"][0]["structure_interface_submodelpart_name"].GetString() + + project_parameters_mapper = KratosMultiphysics.Parameters("{}") + project_parameters_mapper.AddEmptyValue("mapper_type").SetString("NearestElement") + project_parameters_mapper.AddEmptyValue("interface_submodel_part_origin").SetString(fluid_submodelpart_name) + project_parameters_mapper.AddEmptyValue("interface_submodel_part_destination").SetString(structure_submodelpart_name) + + self.interface_mapper = KratosMapping.MapperFactory(self.fluid_solver.main_model_part, + self.structure_solver.main_model_part, + project_parameters_mapper) + + self.double_faced_structure = False + + elif (self.settings["mapper_settings"].size() == 2): + # Get the fluid interface faces submodelpart names + for mapper_id in range(2): + if (self.settings["mapper_settings"][mapper_id]["mapper_face"].GetString() == "Positive"): + pos_face_submodelpart_name = self.settings["mapper_settings"][mapper_id]["fluid_interface_submodelpart_name"].GetString() + elif (self.settings["mapper_settings"][mapper_id]["mapper_face"].GetString() == "Negative"): + neg_face_submodelpart_name = self.settings["mapper_settings"][mapper_id]["fluid_interface_submodelpart_name"].GetString() + else: + raise Exception("Unique mapper flag has been set but more than one mapper exist in mapper_settings.") + # Get the structure submodelpart name + structure_submodelpart_name = self.settings["mapper_settings"][0]["structure_interface_submodelpart_name"].GetString() + + # Grab the interface submodelparts + pos_fluid_submodelpart = self.fluid_solver.main_model_part.GetSubModelPart(pos_face_submodelpart_name) + neg_fluid_submodelpart = self.fluid_solver.main_model_part.GetSubModelPart(neg_face_submodelpart_name) + structure_submodelpart = self.structure_solver.main_model_part.GetSubModelPart(structure_submodelpart_name) + + # TODO: SET THE DOUBLE SIDE SURFACE MAPPING + + # search_radius_factor = 2.0 + # mapper_max_iterations = 200 + # mapper_tolerance = 1e-12 + + # self.interface_mapper = NonConformant_OneSideMap.NonConformantTwoFaces_OneSideMap(pos_fluid_submodelpart, + # neg_fluid_submodelpart, + # structure_submodelpart, + # search_radius_factor, + # mapper_max_iterations, + # mapper_tolerance) + + # TODO: SET THE DOUBLE SIDE SURFACE MAPPING + + self.double_faced_structure = True + + else: + raise Exception("Case with more than 2 mappers has not been implemented yet.\n \ + Please, in case you are using single faced immersed bodies, set the skin entities in a unique submodelpart.\n \ + In case you are considering double faced immersed bodies (shells or membranes), set all the positive faces \ + in a unique submodelpart and all the negative ones in another submodelpart.") + + + def _SetStructureNeumannCondition(self): + + structure_computational_submodelpart = self.structure_solver.GetComputingModelPart() + + # Get the maximum condition id + max_cond_id = 0 + for condition in self.structure_solver.main_model_part.Conditions: + max_cond_id = max(max_cond_id, condition.Id) + + max_cond_id = self.structure_solver.main_model_part.GetCommunicator().MaxAll(max_cond_id) + + # Set up the point load condition in the structure interface + for i in range(self.settings["coupling_solver_settings"]["structure_interfaces_list"].size()): + interface_submodelpart_name = self.settings["coupling_solver_settings"]["structure_interfaces_list"][i].GetString() + interface_submodelpart_i = self.structure_solver.main_model_part.GetSubModelPart(interface_submodelpart_name) + + # Get the number of conditions to be set in each processor + local_nodes_number_accumulated = -1 + local_nodes_number = len(interface_submodelpart_i.GetCommunicator().LocalMesh().Nodes) + local_nodes_number_accumulated = interface_submodelpart_i.GetCommunicator().ScanSum(local_nodes_number, local_nodes_number_accumulated) + + # Create the point load condition + aux_count = max_cond_id + local_nodes_number_accumulated + if self.domain_size == 2: + for node in interface_submodelpart_i.GetCommunicator().LocalMesh().Nodes: + aux_count+=1 + structure_computational_submodelpart.CreateNewCondition("PointLoadCondition2D1N", int(aux_count), [node.Id], self.structure_solver.main_model_part.Properties[0]) + + elif self.domain_size == 3: + for node in interface_submodelpart_i.GetCommunicator().LocalMesh().Nodes: + aux_count+=1 + structure_computational_submodelpart.CreateNewCondition("PointLoadCondition3D1N", int(aux_count), [node.Id], self.structure_solver.main_model_part.Properties[0]) + + + # TODO: GET IT FROM THE SERIAL BASE SOLVER ONCE THE MAPPER IN MAPPING APPLICATION IS USED IN SERIAL PROBLEMS AS WELL + def _ComputeMeshPredictionSingleFaced(self): + + if (KratosMPI.mpi.rank == 0) : print("Computing time step ",self.fluid_solver.main_model_part.ProcessInfo[KratosMultiphysics.TIME_STEPS]," prediction...") + # Get the previous step fluid interface nodal fluxes + self.interface_mapper.Map(KratosMultiphysics.REACTION, + KratosStructural.POINT_LOAD, + KratosMapping.MapperFactory.SWAP_SIGN | + KratosMapping.MapperFactory.CONSERVATIVE) + + # Solve the current step structure problem with the previous step fluid interface nodal fluxes + self.structure_solver.SolveSolutionStep() + + # Map the obtained structure displacement to the fluid interface + self.interface_mapper.InverseMap(KratosMultiphysics.MESH_DISPLACEMENT, + KratosMultiphysics.DISPLACEMENT) + + # Solve the mesh problem + self.mesh_solver.Solve() + + if (KratosMPI.mpi.rank == 0) : print("Mesh prediction computed.") diff --git a/applications/FSIapplication/python_scripts/trilinos_partitioned_fsi_dirichlet_neumann_solver.py b/applications/FSIapplication/python_scripts/trilinos_partitioned_fsi_dirichlet_neumann_solver.py new file mode 100644 index 000000000000..d8f19dae7f4f --- /dev/null +++ b/applications/FSIapplication/python_scripts/trilinos_partitioned_fsi_dirichlet_neumann_solver.py @@ -0,0 +1,317 @@ +from __future__ import print_function, absolute_import, division # makes KratosMultiphysics backward compatible with python 2.6 and 2.7 + +# Import utilities +import math +import python_solvers_wrapper_fluid # Import the fluid Python solvers wrapper + +# Import kratos core and applications +import KratosMultiphysics +import KratosMultiphysics.mpi as KratosMPI +import KratosMultiphysics.MetisApplication as KratosMetis +import KratosMultiphysics.TrilinosApplication as KratosTrilinos +import KratosMultiphysics.ALEApplication as KratosALE +import KratosMultiphysics.MappingApplication as KratosMapping +import KratosMultiphysics.FSIApplication as KratosFSI +import KratosMultiphysics.FluidDynamicsApplication as KratosFluid +import KratosMultiphysics.StructuralMechanicsApplication as KratosStructural + +# Check that KratosMultiphysics was imported in the main script +KratosMultiphysics.CheckForPreviousImport() + +## Import base class file +import trilinos_partitioned_fsi_base_solver + + +def CreateSolver(structure_main_model_part, fluid_main_model_part, project_parameters): + return TrilinosPartitionedFSIDirichletNeumannSolver(structure_main_model_part, fluid_main_model_part, project_parameters) + + +class TrilinosPartitionedFSIDirichletNeumannSolver(trilinos_partitioned_fsi_base_solver.TrilinosPartitionedFSIBaseSolver): + def __init__(self, structure_main_model_part, fluid_main_model_part, project_parameters): + + if (KratosMPI.mpi.rank == 0) : print("*** Trilinos partitioned Dirichlet-Neumann FSI solver construction starts...") + + super(TrilinosPartitionedFSIDirichletNeumannSolver, self).__init__(structure_main_model_part, fluid_main_model_part, project_parameters) + + if (KratosMPI.mpi.rank == 0) : print("*** Trilinos partitioned Dirichlet-Neumann FSI solver construction finished.") + + + def Initialize(self): + + # Set the Trilinos space + self.trilinos_space = KratosTrilinos.TrilinosSparseSpace() + + # Set the Epetra communicator + self.epetra_communicator = KratosTrilinos.CreateCommunicator() + + # Get the domain size + self.domain_size = self._GetDomainSize() + + # Get the nodal update FSI utilities + self.nodal_update_utilities = self._GetNodalUpdateUtilities() + + # Get the partitioned FSI utilities + self.trilinos_partitioned_fsi_utilities = self._GetPartitionedFSIUtilities() + + # Python structure solver initialization + self.structure_solver.Initialize() + + # Ensure that the fluid reaction fluxes are computed if D-N scheme is considered + if self.fluid_solver.settings["compute_reactions"].GetBool() == False: + self.fluid_solver.settings["compute_reactions"].SetBool(True) + + # Python fluid solver initialization + self.fluid_solver.Initialize() + + # Python mesh solver initialization + self.mesh_solver.Initialize() + + # Initialize the Dirichlet-Neumann interface + self._InitializeDirichletNeumannInterface() + + # Construct the interface mapper + self._SetUpMapper() + + # Set the Neumann B.C. in the structure interface + self._SetStructureNeumannCondition() #TODO change when the interface is able to correctly transfer distributed forces + + # Initialize the iteration value vector + self._InitializeIterationValueVector() + + + # Compute the fluid domain NODAL_AREA values (required as weight in the residual norm computation) + KratosMultiphysics.CalculateNodalAreaProcess(self.fluid_solver.GetComputingModelPart(), self.domain_size).Execute() + + # Strategies initialization + super(TrilinosPartitionedFSIDirichletNeumannSolver, self).Initialize() + + + def Solve(self): + + ## Solvers initialization + self.InitializeSolutionStep() + + ## Solvers predict + self.Predict() + + ## Compute mesh prediction ## + if (self.double_faced_structure): + self._ComputeMeshPredictionDoubleFaced() + else: + self._ComputeMeshPredictionSingleFaced() + + ## Non-Linear interface coupling iteration ## + for nl_it in range(1,self.max_nl_it+1): + + if (KratosMPI.mpi.rank == 0) : print(" NL-ITERATION ",nl_it,"STARTS.") + self.fluid_solver.main_model_part.ProcessInfo[KratosMultiphysics.CONVERGENCE_ACCELERATOR_ITERATION] = nl_it + self.structure_solver.main_model_part.ProcessInfo[KratosMultiphysics.CONVERGENCE_ACCELERATOR_ITERATION] = nl_it + + self.coupling_utility.InitializeNonLinearIteration() + + if (KratosMPI.mpi.rank == 0) : print(" Residual computation starts...") + + # Solve the mesh problem as well as the fluid problem + self._SolveMeshAndFluid() + + # Solve the structure problem and computes the displacement residual + if (self.double_faced_structure): + self._SolveStructureDoubleFaced() + dis_residual = self._ComputeDisplacementResidualDoubleFaced() + else: + self._SolveStructureSingleFaced() + dis_residual = self._ComputeDisplacementResidualSingleFaced() + + # Residual computation + nl_res_norm = self.fluid_solver.main_model_part.ProcessInfo[KratosMultiphysics.FSI_INTERFACE_RESIDUAL_NORM] + interface_dofs = self.trilinos_partitioned_fsi_utilities.GetInterfaceResidualSize(self._GetFluidInterfaceSubmodelPart()) + + # Check convergence + if nl_res_norm/math.sqrt(interface_dofs) < self.nl_tol: + if (KratosMPI.mpi.rank == 0): + print(" NON-LINEAR ITERATION CONVERGENCE ACHIEVED") + print(" Total non-linear iterations: ",nl_it," |res|/sqrt(Ndofs) = ",nl_res_norm/math.sqrt(interface_dofs)) + + break + else: + # If convergence is not achieved, perform the correction of the prediction + if (KratosMPI.mpi.rank == 0): + print(" Residual computation finished. |res|/sqrt(Ndofs) =", nl_res_norm/math.sqrt(interface_dofs)) + print(" Performing non-linear iteration ",nl_it," correction.") + + self.coupling_utility.UpdateSolution(dis_residual.GetReference(), self.iteration_value.GetReference()) + + if ((nl_it == self.max_nl_it) and (KratosMPI.mpi.rank == 0)): + print("***********************************************************") + print("***********************************************************") + print(" NON-LINEAR ITERATION CONVERGENCE ACHIEVED ") + print("***********************************************************") + print("***********************************************************") + + self.coupling_utility.FinalizeNonLinearIteration() + + ## Compute the mesh residual as final testing (it is expected to be 0) + self.trilinos_partitioned_fsi_utilities.ComputeFluidInterfaceMeshVelocityResidualNorm(self._GetFluidInterfaceSubmodelPart()) + mesh_res_norm = self.fluid_solver.main_model_part.ProcessInfo.GetValue(KratosMultiphysics.FSI_INTERFACE_MESH_RESIDUAL_NORM) + if (KratosMPI.mpi.rank == 0): + print(" NL residual norm: ", nl_res_norm) + print(" Mesh residual norm: ", mesh_res_norm) + + ## Finalize solution step + self.fluid_solver.FinalizeSolutionStep() + self.structure_solver.FinalizeSolutionStep() + self.coupling_utility.FinalizeSolutionStep() + + + def _InitializeIterationValueVector(self): + # Note that the FSI problem is defined in terms of the fluid interface + # Besides, one of the two interfaces is considered for the residual vector computation + # in case a shell structure is analised. This is due to the fact that the same mesh_solver + # displacement is map to both fluid sides. + + # Initialize the iteration value for the residual computation + self.iteration_value = self.trilinos_space.CreateEmptyVectorPointer(self.epetra_communicator) + self.trilinos_partitioned_fsi_utilities.SetUpInterfaceVector(self._GetFluidInterfaceSubmodelPart(),self.iteration_value) + + + def _InitializeDirichletNeumannInterface(self): + # Initialize Dirichlet fluid interface + num_fl_interfaces = self.settings["coupling_solver_settings"]["fluid_interfaces_list"].size() + for fl_interface_id in range(num_fl_interfaces): + fl_interface_name = self.settings["coupling_solver_settings"]["fluid_interfaces_list"][fl_interface_id].GetString() + fl_interface_submodelpart = self.fluid_solver.main_model_part.GetSubModelPart(fl_interface_name) + + # Fix the VELOCITY, MESH_DISPLACEMENT and MESH_VELOCITY variables in all the fluid interface submodelparts + KratosMultiphysics.VariableUtils().ApplyFixity(KratosMultiphysics.VELOCITY_X, True, fl_interface_submodelpart.Nodes) + KratosMultiphysics.VariableUtils().ApplyFixity(KratosMultiphysics.VELOCITY_Y, True, fl_interface_submodelpart.Nodes) + KratosMultiphysics.VariableUtils().ApplyFixity(KratosMultiphysics.MESH_VELOCITY_X, True, fl_interface_submodelpart.Nodes) + KratosMultiphysics.VariableUtils().ApplyFixity(KratosMultiphysics.MESH_VELOCITY_Y, True, fl_interface_submodelpart.Nodes) + KratosMultiphysics.VariableUtils().ApplyFixity(KratosMultiphysics.MESH_DISPLACEMENT_X, True, fl_interface_submodelpart.Nodes) + KratosMultiphysics.VariableUtils().ApplyFixity(KratosMultiphysics.MESH_DISPLACEMENT_Y, True, fl_interface_submodelpart.Nodes) + if (self.domain_size == 3): + KratosMultiphysics.VariableUtils().ApplyFixity(KratosMultiphysics.VELOCITY_Z, True, fl_interface_submodelpart.Nodes) + KratosMultiphysics.VariableUtils().ApplyFixity(KratosMultiphysics.MESH_VELOCITY_Z, True, fl_interface_submodelpart.Nodes) + KratosMultiphysics.VariableUtils().ApplyFixity(KratosMultiphysics.MESH_DISPLACEMENT_Z, True, fl_interface_submodelpart.Nodes) + + # Set the interface flag + KratosMultiphysics.VariableUtils().SetFlag(KratosMultiphysics.INTERFACE, True, fl_interface_submodelpart.Nodes) + + # Initialize Neumann structure interface + num_str_interfaces = self.settings["coupling_solver_settings"]["structure_interfaces_list"].size() + for str_interface_id in range(num_str_interfaces): + str_interface_name = self.settings["coupling_solver_settings"]["structure_interfaces_list"][str_interface_id].GetString() + str_interface_submodelpart = self.structure_solver.main_model_part.GetSubModelPart(str_interface_name) + + # Set the interface flag + KratosMultiphysics.VariableUtils().SetFlag(KratosMultiphysics.INTERFACE, True, str_interface_submodelpart.Nodes) + + + def _SolveMeshAndFluid(self): + + # Set the iteration_value displacement as MESH_DISPLACEMENT + num_fl_interfaces = self.settings["coupling_solver_settings"]["fluid_interfaces_list"].size() + for fl_interface_id in range(num_fl_interfaces): + fl_interface_name = self.settings["coupling_solver_settings"]["fluid_interfaces_list"][fl_interface_id].GetString() + fl_interface_submodelpart = self.fluid_solver.main_model_part.GetSubModelPart(fl_interface_name) + self.trilinos_partitioned_fsi_utilities.UpdateInterfaceValues(fl_interface_submodelpart, + KratosMultiphysics.MESH_DISPLACEMENT, + self.iteration_value.GetReference()) + + # Solve the mesh problem (or moves the interface nodes) + if (self.solve_mesh_at_each_iteration == True): + self.mesh_solver.Solve() + else: + self.mesh_solver.MoveNodes() + + # Update MESH_VELOCITY and MESH_ACCELERATION with Newmark formulas + self.nodal_update_utilities.UpdateMeshTimeDerivatives(self.fluid_main_model_part, self.time_step) + + # Impose the structure MESH_VELOCITY and MESH_ACCELERATION in the fluid interface VELOCITY and ACCELERATION + self.nodal_update_utilities.UpdateTimeDerivativesOnInterface(self._GetFluidInterfaceSubmodelPart()) + + # Solve fluid problem + self.fluid_solver.SolveSolutionStep() + + + def _SolveStructureSingleFaced(self): + + # Transfer fluid reaction to solid interface + self.interface_mapper.Map(KratosMultiphysics.REACTION, + KratosStructural.POINT_LOAD, + KratosMapping.MapperFactory.SWAP_SIGN | + KratosMapping.MapperFactory.CONSERVATIVE) + + # Solve the structure problem + self.structure_solver.SolveSolutionStep() + + + # TODO: UPDATE THIS ONCE THE DOUBLE SIDED SURFACES MAPPING IS AVAILABLE IN MAPPING APPLICATION + def _SolveStructureDoubleFaced(self): + + # Transfer fluid reaction from both sides to the structure interface + keep_sign = False + distribute_load = True + self.interface_mapper.PositiveFluidToStructure_VectorMap(KratosMultiphysics.REACTION, + KratosFSI.POSITIVE_MAPPED_VECTOR_VARIABLE, + keep_sign, + distribute_load) + self.interface_mapper.NegativeFluidToStructure_VectorMap(KratosMultiphysics.REACTION, + KratosFSI.NEGATIVE_MAPPED_VECTOR_VARIABLE, + keep_sign, + distribute_load) + + # Add the two faces contributions to the POINT_LOAD variable + # TODO: Add this to the variables utils + for node in self._GetStructureInterfaceSubmodelPart().Nodes: + pos_face_force = node.GetSolutionStepValue(KratosFSI.POSITIVE_MAPPED_VECTOR_VARIABLE) + neg_face_force = node.GetSolutionStepValue(KratosFSI.NEGATIVE_MAPPED_VECTOR_VARIABLE) + node.SetSolutionStepValue(KratosStructural.POINT_LOAD, 0, pos_face_force+neg_face_force) + + # Solve the structure problem + self.structure_solver.SolveSolutionStep() + + + def _ComputeDisplacementResidualSingleFaced(self): + # Project the structure displacement onto the fluid interface + self.interface_mapper.InverseMap(KratosMultiphysics.VECTOR_PROJECTED, + KratosMultiphysics.DISPLACEMENT) + + # Compute the fluid interface residual vector by means of the VECTOR_PROJECTED variable + # Besides, its norm is stored within the ProcessInfo. + disp_residual = self.trilinos_space.CreateEmptyVectorPointer(self.epetra_communicator) + self.trilinos_partitioned_fsi_utilities.SetUpInterfaceVector(self._GetFluidInterfaceSubmodelPart(), disp_residual) + self.trilinos_partitioned_fsi_utilities.ComputeInterfaceVectorResidual(self._GetFluidInterfaceSubmodelPart(), + KratosMultiphysics.MESH_DISPLACEMENT, + KratosMultiphysics.VECTOR_PROJECTED, + disp_residual.GetReference()) + + return disp_residual + + + # TODO: UPDATE THIS ONCE THE DOUBLE SIDED SURFACES MAPPING IS AVAILABLE IN MAPPING APPLICATION + def _ComputeDisplacementResidualDoubleFaced(self): + # Project the structure velocity onto the fluid interface + keep_sign = True + distribute_load = False + #TODO: One of these mappings is not needed. At the moment both are performed to ensure that + # the _GetFluidInterfaceSubmodelPart(), which is the one used to compute the interface residual, + # gets the structure DISPLACEMENT. Think a way to properly identify the reference fluid interface. + self.interface_mapper.StructureToPositiveFluid_VectorMap(KratosMultiphysics.DISPLACEMENT, + KratosMultiphysics.VECTOR_PROJECTED, + keep_sign, + distribute_load) + self.interface_mapper.StructureToNegativeFluid_VectorMap(KratosMultiphysics.DISPLACEMENT, + KratosMultiphysics.VECTOR_PROJECTED, + keep_sign, + distribute_load) + + # Compute the fluid interface residual vector by means of the VECTOR_PROJECTED variable + # Besides, its norm is stored within the ProcessInfo. + disp_residual = self.trilinos_space.CreateEmptyVectorPointer(self.epetra_communicator) + self.trilinos_partitioned_fsi_utilities.SetUpInterfaceVector(self._GetFluidInterfaceSubmodelPart(), disp_residual) + self.trilinos_partitioned_fsi_utilities.ComputeInterfaceVectorResidual(self._GetFluidInterfaceSubmodelPart(), + KratosMultiphysics.MESH_DISPLACEMENT, + KratosMultiphysics.VECTOR_PROJECTED, + disp_residual.GetReference()) + + return disp_residual diff --git a/applications/FSIapplication/tests/AcceleratorSpringTests/box_fluid.mdpa b/applications/FSIapplication/tests/AcceleratorSpringTests/box_fluid.mdpa new file mode 100644 index 000000000000..50be5ed7cf8b --- /dev/null +++ b/applications/FSIapplication/tests/AcceleratorSpringTests/box_fluid.mdpa @@ -0,0 +1,707 @@ +Begin ModelPartData +// VARIABLE_NAME value +End ModelPartData + +Begin Properties 0 +End Properties + +Begin Nodes +1 0.000000e+00 0.000000e+00 0.000000e+00 +2 2.000000e-01 0.000000e+00 0.000000e+00 +3 4.000000e-01 0.000000e+00 0.000000e+00 +4 6.000000e-01 0.000000e+00 0.000000e+00 +5 8.000000e-01 0.000000e+00 0.000000e+00 +6 1.000000e+00 0.000000e+00 0.000000e+00 +7 0.000000e+00 2.000000e-01 0.000000e+00 +8 2.000000e-01 2.000000e-01 0.000000e+00 +9 4.000000e-01 2.000000e-01 0.000000e+00 +10 6.000000e-01 2.000000e-01 0.000000e+00 +11 8.000000e-01 2.000000e-01 0.000000e+00 +12 1.000000e+00 2.000000e-01 0.000000e+00 +13 0.000000e+00 4.000000e-01 0.000000e+00 +14 2.000000e-01 4.000000e-01 0.000000e+00 +15 4.000000e-01 4.000000e-01 0.000000e+00 +16 6.000000e-01 4.000000e-01 0.000000e+00 +17 8.000000e-01 4.000000e-01 0.000000e+00 +18 1.000000e+00 4.000000e-01 0.000000e+00 +19 0.000000e+00 6.000000e-01 0.000000e+00 +20 2.000000e-01 6.000000e-01 0.000000e+00 +21 4.000000e-01 6.000000e-01 0.000000e+00 +22 6.000000e-01 6.000000e-01 0.000000e+00 +23 8.000000e-01 6.000000e-01 0.000000e+00 +24 1.000000e+00 6.000000e-01 0.000000e+00 +25 0.000000e+00 8.000000e-01 0.000000e+00 +26 2.000000e-01 8.000000e-01 0.000000e+00 +27 4.000000e-01 8.000000e-01 0.000000e+00 +28 6.000000e-01 8.000000e-01 0.000000e+00 +29 8.000000e-01 8.000000e-01 0.000000e+00 +30 1.000000e+00 8.000000e-01 0.000000e+00 +31 0.000000e+00 1.000000e+00 0.000000e+00 +32 2.000000e-01 1.000000e+00 0.000000e+00 +33 4.000000e-01 1.000000e+00 0.000000e+00 +34 6.000000e-01 1.000000e+00 0.000000e+00 +35 8.000000e-01 1.000000e+00 0.000000e+00 +36 1.000000e+00 1.000000e+00 0.000000e+00 +37 0.000000e+00 0.000000e+00 1.000000e+00 +38 2.000000e-01 0.000000e+00 1.000000e+00 +39 4.000000e-01 0.000000e+00 1.000000e+00 +40 6.000000e-01 0.000000e+00 1.000000e+00 +41 8.000000e-01 0.000000e+00 1.000000e+00 +42 1.000000e+00 0.000000e+00 1.000000e+00 +43 0.000000e+00 2.000000e-01 1.000000e+00 +44 2.000000e-01 2.000000e-01 1.000000e+00 +45 4.000000e-01 2.000000e-01 1.000000e+00 +46 6.000000e-01 2.000000e-01 1.000000e+00 +47 8.000000e-01 2.000000e-01 1.000000e+00 +48 1.000000e+00 2.000000e-01 1.000000e+00 +49 0.000000e+00 4.000000e-01 1.000000e+00 +50 2.000000e-01 4.000000e-01 1.000000e+00 +51 4.000000e-01 4.000000e-01 1.000000e+00 +52 6.000000e-01 4.000000e-01 1.000000e+00 +53 8.000000e-01 4.000000e-01 1.000000e+00 +54 1.000000e+00 4.000000e-01 1.000000e+00 +55 0.000000e+00 6.000000e-01 1.000000e+00 +56 2.000000e-01 6.000000e-01 1.000000e+00 +57 4.000000e-01 6.000000e-01 1.000000e+00 +58 6.000000e-01 6.000000e-01 1.000000e+00 +59 8.000000e-01 6.000000e-01 1.000000e+00 +60 1.000000e+00 6.000000e-01 1.000000e+00 +61 0.000000e+00 8.000000e-01 1.000000e+00 +62 2.000000e-01 8.000000e-01 1.000000e+00 +63 4.000000e-01 8.000000e-01 1.000000e+00 +64 6.000000e-01 8.000000e-01 1.000000e+00 +65 8.000000e-01 8.000000e-01 1.000000e+00 +66 1.000000e+00 8.000000e-01 1.000000e+00 +67 0.000000e+00 1.000000e+00 1.000000e+00 +68 2.000000e-01 1.000000e+00 1.000000e+00 +69 4.000000e-01 1.000000e+00 1.000000e+00 +70 6.000000e-01 1.000000e+00 1.000000e+00 +71 8.000000e-01 1.000000e+00 1.000000e+00 +72 1.000000e+00 1.000000e+00 1.000000e+00 +End Nodes + +Begin Elements VMS3D +1 0 8 43 38 44 +2 0 8 43 37 38 +3 0 7 37 8 43 +4 0 7 1 8 37 +5 0 8 37 2 38 +6 0 8 1 2 37 +7 0 9 44 39 45 +8 0 9 44 38 39 +9 0 8 38 9 44 +10 0 8 2 9 38 +11 0 9 38 3 39 +12 0 9 2 3 38 +13 0 10 45 40 46 +14 0 10 45 39 40 +15 0 9 39 10 45 +16 0 9 3 10 39 +17 0 10 39 4 40 +18 0 10 3 4 39 +19 0 11 46 41 47 +20 0 11 46 40 41 +21 0 10 40 11 46 +22 0 10 4 11 40 +23 0 11 40 5 41 +24 0 11 4 5 40 +25 0 12 47 42 48 +26 0 12 47 41 42 +27 0 11 41 12 47 +28 0 11 5 12 41 +29 0 12 41 6 42 +30 0 12 5 6 41 +31 0 14 49 44 50 +32 0 14 49 43 44 +33 0 13 43 14 49 +34 0 13 7 14 43 +35 0 14 43 8 44 +36 0 14 7 8 43 +37 0 15 50 45 51 +38 0 15 50 44 45 +39 0 14 44 15 50 +40 0 14 8 15 44 +41 0 15 44 9 45 +42 0 15 8 9 44 +43 0 16 51 46 52 +44 0 16 51 45 46 +45 0 15 45 16 51 +46 0 15 9 16 45 +47 0 16 45 10 46 +48 0 16 9 10 45 +49 0 17 52 47 53 +50 0 17 52 46 47 +51 0 16 46 17 52 +52 0 16 10 17 46 +53 0 17 46 11 47 +54 0 17 10 11 46 +55 0 18 53 48 54 +56 0 18 53 47 48 +57 0 17 47 18 53 +58 0 17 11 18 47 +59 0 18 47 12 48 +60 0 18 11 12 47 +61 0 20 55 50 56 +62 0 20 55 49 50 +63 0 19 49 20 55 +64 0 19 13 20 49 +65 0 20 49 14 50 +66 0 20 13 14 49 +67 0 21 56 51 57 +68 0 21 56 50 51 +69 0 20 50 21 56 +70 0 20 14 21 50 +71 0 21 50 15 51 +72 0 21 14 15 50 +73 0 22 57 52 58 +74 0 22 57 51 52 +75 0 21 51 22 57 +76 0 21 15 22 51 +77 0 22 51 16 52 +78 0 22 15 16 51 +79 0 23 58 53 59 +80 0 23 58 52 53 +81 0 22 52 23 58 +82 0 22 16 23 52 +83 0 23 52 17 53 +84 0 23 16 17 52 +85 0 24 59 54 60 +86 0 24 59 53 54 +87 0 23 53 24 59 +88 0 23 17 24 53 +89 0 24 53 18 54 +90 0 24 17 18 53 +91 0 26 61 56 62 +92 0 26 61 55 56 +93 0 25 55 26 61 +94 0 25 19 26 55 +95 0 26 55 20 56 +96 0 26 19 20 55 +97 0 27 62 57 63 +98 0 27 62 56 57 +99 0 26 56 27 62 +100 0 26 20 27 56 +101 0 27 56 21 57 +102 0 27 20 21 56 +103 0 28 63 58 64 +104 0 28 63 57 58 +105 0 27 57 28 63 +106 0 27 21 28 57 +107 0 28 57 22 58 +108 0 28 21 22 57 +109 0 29 64 59 65 +110 0 29 64 58 59 +111 0 28 58 29 64 +112 0 28 22 29 58 +113 0 29 58 23 59 +114 0 29 22 23 58 +115 0 30 65 60 66 +116 0 30 65 59 60 +117 0 29 59 30 65 +118 0 29 23 30 59 +119 0 30 59 24 60 +120 0 30 23 24 59 +121 0 32 67 62 68 +122 0 32 67 61 62 +123 0 31 61 32 67 +124 0 31 25 32 61 +125 0 32 61 26 62 +126 0 32 25 26 61 +127 0 33 68 63 69 +128 0 33 68 62 63 +129 0 32 62 33 68 +130 0 32 26 33 62 +131 0 33 62 27 63 +132 0 33 26 27 62 +133 0 34 69 64 70 +134 0 34 69 63 64 +135 0 33 63 34 69 +136 0 33 27 34 63 +137 0 34 63 28 64 +138 0 34 27 28 63 +139 0 35 70 65 71 +140 0 35 70 64 65 +141 0 34 64 35 70 +142 0 34 28 35 64 +143 0 35 64 29 65 +144 0 35 28 29 64 +145 0 36 71 66 72 +146 0 36 71 65 66 +147 0 35 65 36 71 +148 0 35 29 36 65 +149 0 36 65 30 66 +150 0 36 29 30 65 +End Elements + +Begin Conditions WallCondition3D //Front +1 0 7 1 37 +2 0 7 37 43 +3 0 13 7 43 +4 0 13 43 49 +5 0 19 13 49 +6 0 19 49 55 +7 0 25 19 55 +8 0 25 55 61 +9 0 31 25 61 +10 0 31 61 67 +End Conditions + +Begin Conditions WallCondition3D //Back +11 0 12 42 6 +12 0 12 48 42 +13 0 18 48 12 +14 0 18 54 48 +15 0 24 54 18 +16 0 24 60 54 +17 0 30 60 24 +18 0 30 66 60 +19 0 36 66 30 +20 0 36 72 66 +End Conditions + +Begin Conditions WallCondition3D //Right +21 0 2 38 37 +22 0 37 1 2 +23 0 3 39 38 +24 0 38 2 3 +25 0 4 40 39 +26 0 39 3 4 +27 0 5 41 40 +28 0 40 4 5 +29 0 6 42 41 +30 0 41 5 6 +End Conditions + +Begin Conditions WallCondition3D //Left +31 0 32 67 68 +32 0 32 31 67 +33 0 33 68 69 +34 0 33 32 68 +35 0 34 69 70 +36 0 34 33 69 +37 0 35 70 71 +38 0 35 34 70 +39 0 36 71 72 +40 0 36 35 71 +End Conditions + +Begin Conditions WallCondition3D //Bottom +41 0 7 8 1 +42 0 8 2 1 +43 0 8 9 2 +44 0 9 3 2 +45 0 9 10 3 +46 0 10 4 3 +47 0 10 11 4 +48 0 11 5 4 +49 0 11 12 5 +50 0 12 6 5 +51 0 13 14 7 +52 0 14 8 7 +53 0 14 15 8 +54 0 15 9 8 +55 0 15 16 9 +56 0 16 10 9 +57 0 16 17 10 +58 0 17 11 10 +59 0 17 18 11 +60 0 18 12 11 +61 0 19 20 13 +62 0 20 14 13 +63 0 20 21 14 +64 0 21 15 14 +65 0 21 22 15 +66 0 22 16 15 +67 0 22 23 16 +68 0 23 17 16 +69 0 23 24 17 +70 0 24 18 17 +71 0 25 26 19 +72 0 26 20 19 +73 0 26 27 20 +74 0 27 21 20 +75 0 27 28 21 +76 0 28 22 21 +77 0 28 29 22 +78 0 29 23 22 +79 0 29 30 23 +80 0 30 24 23 +81 0 31 32 25 +82 0 32 26 25 +83 0 32 33 26 +84 0 33 27 26 +85 0 33 34 27 +86 0 34 28 27 +87 0 34 35 28 +88 0 35 29 28 +89 0 35 36 29 +90 0 36 30 29 +End Conditions + +Begin Conditions WallCondition3D //Top +91 0 43 37 38 +92 0 43 38 44 +93 0 44 38 39 +94 0 44 39 45 +95 0 45 39 40 +96 0 45 40 46 +97 0 46 40 41 +98 0 46 41 47 +99 0 47 41 42 +100 0 47 42 48 +101 0 49 43 44 +102 0 49 44 50 +103 0 50 44 45 +104 0 50 45 51 +105 0 51 45 46 +106 0 51 46 52 +107 0 52 46 47 +108 0 52 47 53 +109 0 53 47 48 +110 0 53 48 54 +111 0 55 49 50 +112 0 55 50 56 +113 0 56 50 51 +114 0 56 51 57 +115 0 57 51 52 +116 0 57 52 58 +117 0 58 52 53 +118 0 58 53 59 +119 0 59 53 54 +120 0 59 54 60 +121 0 61 55 56 +122 0 61 56 62 +123 0 62 56 57 +124 0 62 57 63 +125 0 63 57 58 +126 0 63 58 64 +127 0 64 58 59 +128 0 64 59 65 +129 0 65 59 60 +130 0 65 60 66 +131 0 67 61 62 +132 0 67 62 68 +133 0 68 62 63 +134 0 68 63 69 +135 0 69 63 64 +136 0 69 64 70 +137 0 70 64 65 +138 0 70 65 71 +139 0 71 65 66 +140 0 71 66 72 +End Conditions + +Begin SubModelPart Front +Begin SubModelPartNodes +1 +7 +13 +19 +25 +31 +37 +43 +49 +55 +61 +67 +End SubModelPartNodes + +Begin SubModelPartConditions +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +End SubModelPartConditions + +End SubModelPart + +Begin SubModelPart Back +Begin SubModelPartNodes +6 +12 +18 +24 +30 +36 +42 +48 +54 +60 +66 +72 +End SubModelPartNodes + +Begin SubModelPartConditions +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +End SubModelPartConditions + +End SubModelPart + +Begin SubModelPart Right +Begin SubModelPartNodes +1 +2 +3 +4 +5 +6 +37 +38 +39 +40 +41 +42 +End SubModelPartNodes + +Begin SubModelPartConditions +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +End SubModelPartConditions + +End SubModelPart + +Begin SubModelPart Left +Begin SubModelPartNodes +31 +32 +33 +34 +35 +36 +67 +68 +69 +70 +71 +72 +End SubModelPartNodes + +Begin SubModelPartConditions +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +End SubModelPartConditions + +End SubModelPart + +Begin SubModelPart Bottom +Begin SubModelPartNodes +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +End SubModelPartNodes + +Begin SubModelPartConditions +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +End SubModelPartConditions + +End SubModelPart + +Begin SubModelPart Top +Begin SubModelPartNodes +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +End SubModelPartNodes + +Begin SubModelPartConditions +91 +92 +93 +94 +95 +96 +97 +98 +99 +100 +101 +102 +103 +104 +105 +106 +107 +108 +109 +110 +111 +112 +113 +114 +115 +116 +117 +118 +119 +120 +121 +122 +123 +124 +125 +126 +127 +128 +129 +130 +131 +132 +133 +134 +135 +136 +137 +138 +139 +140 +End SubModelPartConditions + +End SubModelPart + diff --git a/applications/FSIapplication/tests/AcceleratorSpringTests/box_fluid_0.mdpa b/applications/FSIapplication/tests/AcceleratorSpringTests/box_fluid_0.mdpa new file mode 100644 index 000000000000..3a0506333676 --- /dev/null +++ b/applications/FSIapplication/tests/AcceleratorSpringTests/box_fluid_0.mdpa @@ -0,0 +1,521 @@ +Begin ModelPartData + +End ModelPartData +Begin Properties 0 +End Properties +Begin Nodes +1 0.000000e+00 0.000000e+00 0.000000e+00 +2 2.000000e-01 0.000000e+00 0.000000e+00 +3 4.000000e-01 0.000000e+00 0.000000e+00 +4 6.000000e-01 0.000000e+00 0.000000e+00 +5 8.000000e-01 0.000000e+00 0.000000e+00 +6 1.000000e+00 0.000000e+00 0.000000e+00 +7 0.000000e+00 2.000000e-01 0.000000e+00 +8 2.000000e-01 2.000000e-01 0.000000e+00 +9 4.000000e-01 2.000000e-01 0.000000e+00 +10 6.000000e-01 2.000000e-01 0.000000e+00 +11 8.000000e-01 2.000000e-01 0.000000e+00 +12 1.000000e+00 2.000000e-01 0.000000e+00 +13 0.000000e+00 4.000000e-01 0.000000e+00 +14 2.000000e-01 4.000000e-01 0.000000e+00 +15 4.000000e-01 4.000000e-01 0.000000e+00 +16 6.000000e-01 4.000000e-01 0.000000e+00 +17 8.000000e-01 4.000000e-01 0.000000e+00 +18 1.000000e+00 4.000000e-01 0.000000e+00 +19 0.000000e+00 6.000000e-01 0.000000e+00 +20 2.000000e-01 6.000000e-01 0.000000e+00 +21 4.000000e-01 6.000000e-01 0.000000e+00 +22 6.000000e-01 6.000000e-01 0.000000e+00 +23 8.000000e-01 6.000000e-01 0.000000e+00 +24 1.000000e+00 6.000000e-01 0.000000e+00 +37 0.000000e+00 0.000000e+00 1.000000e+00 +38 2.000000e-01 0.000000e+00 1.000000e+00 +39 4.000000e-01 0.000000e+00 1.000000e+00 +40 6.000000e-01 0.000000e+00 1.000000e+00 +41 8.000000e-01 0.000000e+00 1.000000e+00 +42 1.000000e+00 0.000000e+00 1.000000e+00 +43 0.000000e+00 2.000000e-01 1.000000e+00 +44 2.000000e-01 2.000000e-01 1.000000e+00 +45 4.000000e-01 2.000000e-01 1.000000e+00 +46 6.000000e-01 2.000000e-01 1.000000e+00 +47 8.000000e-01 2.000000e-01 1.000000e+00 +48 1.000000e+00 2.000000e-01 1.000000e+00 +49 0.000000e+00 4.000000e-01 1.000000e+00 +50 2.000000e-01 4.000000e-01 1.000000e+00 +51 4.000000e-01 4.000000e-01 1.000000e+00 +52 6.000000e-01 4.000000e-01 1.000000e+00 +53 8.000000e-01 4.000000e-01 1.000000e+00 +54 1.000000e+00 4.000000e-01 1.000000e+00 +55 0.000000e+00 6.000000e-01 1.000000e+00 +56 2.000000e-01 6.000000e-01 1.000000e+00 +57 4.000000e-01 6.000000e-01 1.000000e+00 +58 6.000000e-01 6.000000e-01 1.000000e+00 +59 8.000000e-01 6.000000e-01 1.000000e+00 +End Nodes +Begin Elements VMS3D +1 0 8 43 38 44 +2 0 8 43 37 38 +3 0 7 37 8 43 +4 0 7 1 8 37 +5 0 8 37 2 38 +6 0 8 1 2 37 +7 0 9 44 39 45 +8 0 9 44 38 39 +9 0 8 38 9 44 +10 0 8 2 9 38 +11 0 9 38 3 39 +12 0 9 2 3 38 +13 0 10 45 40 46 +14 0 10 45 39 40 +15 0 9 39 10 45 +16 0 9 3 10 39 +17 0 10 39 4 40 +18 0 10 3 4 39 +19 0 11 46 41 47 +20 0 11 46 40 41 +21 0 10 40 11 46 +22 0 10 4 11 40 +23 0 11 40 5 41 +24 0 11 4 5 40 +25 0 12 47 42 48 +26 0 12 47 41 42 +27 0 11 41 12 47 +28 0 11 5 12 41 +29 0 12 41 6 42 +30 0 12 5 6 41 +31 0 14 49 44 50 +32 0 14 49 43 44 +33 0 13 43 14 49 +34 0 13 7 14 43 +35 0 14 43 8 44 +36 0 14 7 8 43 +37 0 15 50 45 51 +38 0 15 50 44 45 +39 0 14 44 15 50 +40 0 14 8 15 44 +41 0 15 44 9 45 +42 0 15 8 9 44 +43 0 16 51 46 52 +44 0 16 51 45 46 +45 0 15 45 16 51 +46 0 15 9 16 45 +47 0 16 45 10 46 +48 0 16 9 10 45 +49 0 17 52 47 53 +50 0 17 52 46 47 +51 0 16 46 17 52 +52 0 16 10 17 46 +53 0 17 46 11 47 +54 0 17 10 11 46 +55 0 18 53 48 54 +56 0 18 53 47 48 +57 0 17 47 18 53 +58 0 17 11 18 47 +59 0 18 47 12 48 +60 0 18 11 12 47 +65 0 20 49 14 50 +66 0 20 13 14 49 +71 0 21 50 15 51 +72 0 21 14 15 50 +77 0 22 51 16 52 +78 0 22 15 16 51 +83 0 23 52 17 53 +84 0 23 16 17 52 +86 0 24 59 53 54 +87 0 23 53 24 59 +88 0 23 17 24 53 +89 0 24 53 18 54 +90 0 24 17 18 53 +End Elements +Begin Conditions WallCondition3D +1 0 7 1 37 +2 0 7 37 43 +3 0 13 7 43 +4 0 13 43 49 +5 0 19 13 49 +End Conditions +Begin Conditions WallCondition3D +11 0 12 42 6 +12 0 12 48 42 +13 0 18 48 12 +14 0 18 54 48 +15 0 24 54 18 +End Conditions +Begin Conditions WallCondition3D +21 0 2 38 37 +22 0 37 1 2 +23 0 3 39 38 +24 0 38 2 3 +25 0 4 40 39 +26 0 39 3 4 +27 0 5 41 40 +28 0 40 4 5 +29 0 6 42 41 +30 0 41 5 6 +End Conditions +Begin Conditions WallCondition3D +End Conditions +Begin Conditions WallCondition3D +41 0 7 8 1 +42 0 8 2 1 +43 0 8 9 2 +44 0 9 3 2 +45 0 9 10 3 +46 0 10 4 3 +47 0 10 11 4 +48 0 11 5 4 +49 0 11 12 5 +50 0 12 6 5 +51 0 13 14 7 +52 0 14 8 7 +53 0 14 15 8 +54 0 15 9 8 +55 0 15 16 9 +56 0 16 10 9 +57 0 16 17 10 +58 0 17 11 10 +59 0 17 18 11 +60 0 18 12 11 +62 0 20 14 13 +64 0 21 15 14 +66 0 22 16 15 +68 0 23 17 16 +70 0 24 18 17 +End Conditions +Begin Conditions WallCondition3D +91 0 43 37 38 +92 0 43 38 44 +93 0 44 38 39 +94 0 44 39 45 +95 0 45 39 40 +96 0 45 40 46 +97 0 46 40 41 +98 0 46 41 47 +99 0 47 41 42 +100 0 47 42 48 +101 0 49 43 44 +102 0 49 44 50 +103 0 50 44 45 +104 0 50 45 51 +105 0 51 45 46 +106 0 51 46 52 +107 0 52 46 47 +108 0 52 47 53 +109 0 53 47 48 +110 0 53 48 54 +111 0 55 49 50 +113 0 56 50 51 +115 0 57 51 52 +117 0 58 52 53 +119 0 59 53 54 +End Conditions +Begin SubModelPart Front +Begin SubModelPartNodes +1 +7 +13 +19 +37 +43 +49 +55 +End SubModelPartNodes +Begin SubModelPartConditions +1 +2 +3 +4 +5 +End SubModelPartConditions +End SubModelPart +Begin SubModelPart Back +Begin SubModelPartNodes +6 +12 +18 +24 +42 +48 +54 +End SubModelPartNodes +Begin SubModelPartConditions +11 +12 +13 +14 +15 +End SubModelPartConditions +End SubModelPart +Begin SubModelPart Right +Begin SubModelPartNodes +1 +2 +3 +4 +5 +6 +37 +38 +39 +40 +41 +42 +End SubModelPartNodes +Begin SubModelPartConditions +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +End SubModelPartConditions +End SubModelPart +Begin SubModelPart Left +Begin SubModelPartNodes +End SubModelPartNodes +Begin SubModelPartConditions +End SubModelPartConditions +End SubModelPart +Begin SubModelPart Bottom +Begin SubModelPartNodes +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +End SubModelPartNodes +Begin SubModelPartConditions +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +62 +64 +66 +68 +70 +End SubModelPartConditions +End SubModelPart +Begin SubModelPart Top +Begin SubModelPartNodes +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +End SubModelPartNodes +Begin SubModelPartConditions +91 +92 +93 +94 +95 +96 +97 +98 +99 +100 +101 +102 +103 +104 +105 +106 +107 +108 +109 +110 +111 +113 +115 +117 +119 +End SubModelPartConditions +End SubModelPart +Begin NodalData PARTITION_INDEX +1 0 0 +2 0 0 +3 0 0 +4 0 0 +5 0 0 +6 0 0 +7 0 0 +8 0 0 +9 0 0 +10 0 0 +11 0 0 +12 0 0 +13 0 0 +14 0 0 +15 0 0 +16 0 0 +17 0 0 +18 0 0 +19 0 1 +20 0 1 +21 0 1 +22 0 1 +23 0 1 +24 0 1 +37 0 0 +38 0 0 +39 0 0 +40 0 0 +41 0 0 +42 0 0 +43 0 0 +44 0 0 +45 0 0 +46 0 0 +47 0 0 +48 0 0 +49 0 0 +50 0 0 +51 0 0 +52 0 0 +53 0 0 +54 0 0 +55 0 1 +56 0 1 +57 0 1 +58 0 1 +59 0 1 +End NodalData +Begin CommunicatorData +NEIGHBOURS_INDICES [4](1,-1,-1,-1) +NUMBER_OF_COLORS 1 + Begin LocalNodes 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 37 + 38 + 39 + 40 + 41 + 42 + 43 + 44 + 45 + 46 + 47 + 48 + 49 + 50 + 51 + 52 + 53 + 54 + End LocalNodes + Begin LocalNodes 1 + 13 + 14 + 15 + 16 + 17 + 49 + 50 + 51 + 52 + 53 + 54 + End LocalNodes + Begin GhostNodes 1 + 19 + 20 + 21 + 22 + 23 + 24 + 55 + 56 + 57 + 58 + 59 + End GhostNodes + Begin GhostNodes 0 + 19 + 20 + 21 + 22 + 23 + 24 + 55 + 56 + 57 + 58 + 59 + End GhostNodes +End CommunicatorData diff --git a/applications/FSIapplication/tests/AcceleratorSpringTests/box_fluid_1.mdpa b/applications/FSIapplication/tests/AcceleratorSpringTests/box_fluid_1.mdpa new file mode 100644 index 000000000000..0c22ccfa610f --- /dev/null +++ b/applications/FSIapplication/tests/AcceleratorSpringTests/box_fluid_1.mdpa @@ -0,0 +1,525 @@ +Begin ModelPartData + +End ModelPartData +Begin Properties 0 +End Properties +Begin Nodes +13 0.000000e+00 4.000000e-01 0.000000e+00 +14 2.000000e-01 4.000000e-01 0.000000e+00 +15 4.000000e-01 4.000000e-01 0.000000e+00 +16 6.000000e-01 4.000000e-01 0.000000e+00 +17 8.000000e-01 4.000000e-01 0.000000e+00 +19 0.000000e+00 6.000000e-01 0.000000e+00 +20 2.000000e-01 6.000000e-01 0.000000e+00 +21 4.000000e-01 6.000000e-01 0.000000e+00 +22 6.000000e-01 6.000000e-01 0.000000e+00 +23 8.000000e-01 6.000000e-01 0.000000e+00 +24 1.000000e+00 6.000000e-01 0.000000e+00 +25 0.000000e+00 8.000000e-01 0.000000e+00 +26 2.000000e-01 8.000000e-01 0.000000e+00 +27 4.000000e-01 8.000000e-01 0.000000e+00 +28 6.000000e-01 8.000000e-01 0.000000e+00 +29 8.000000e-01 8.000000e-01 0.000000e+00 +30 1.000000e+00 8.000000e-01 0.000000e+00 +31 0.000000e+00 1.000000e+00 0.000000e+00 +32 2.000000e-01 1.000000e+00 0.000000e+00 +33 4.000000e-01 1.000000e+00 0.000000e+00 +34 6.000000e-01 1.000000e+00 0.000000e+00 +35 8.000000e-01 1.000000e+00 0.000000e+00 +36 1.000000e+00 1.000000e+00 0.000000e+00 +49 0.000000e+00 4.000000e-01 1.000000e+00 +50 2.000000e-01 4.000000e-01 1.000000e+00 +51 4.000000e-01 4.000000e-01 1.000000e+00 +52 6.000000e-01 4.000000e-01 1.000000e+00 +53 8.000000e-01 4.000000e-01 1.000000e+00 +54 1.000000e+00 4.000000e-01 1.000000e+00 +55 0.000000e+00 6.000000e-01 1.000000e+00 +56 2.000000e-01 6.000000e-01 1.000000e+00 +57 4.000000e-01 6.000000e-01 1.000000e+00 +58 6.000000e-01 6.000000e-01 1.000000e+00 +59 8.000000e-01 6.000000e-01 1.000000e+00 +60 1.000000e+00 6.000000e-01 1.000000e+00 +61 0.000000e+00 8.000000e-01 1.000000e+00 +62 2.000000e-01 8.000000e-01 1.000000e+00 +63 4.000000e-01 8.000000e-01 1.000000e+00 +64 6.000000e-01 8.000000e-01 1.000000e+00 +65 8.000000e-01 8.000000e-01 1.000000e+00 +66 1.000000e+00 8.000000e-01 1.000000e+00 +67 0.000000e+00 1.000000e+00 1.000000e+00 +68 2.000000e-01 1.000000e+00 1.000000e+00 +69 4.000000e-01 1.000000e+00 1.000000e+00 +70 6.000000e-01 1.000000e+00 1.000000e+00 +71 8.000000e-01 1.000000e+00 1.000000e+00 +72 1.000000e+00 1.000000e+00 1.000000e+00 +End Nodes +Begin Elements VMS3D +61 0 20 55 50 56 +62 0 20 55 49 50 +63 0 19 49 20 55 +64 0 19 13 20 49 +67 0 21 56 51 57 +68 0 21 56 50 51 +69 0 20 50 21 56 +70 0 20 14 21 50 +73 0 22 57 52 58 +74 0 22 57 51 52 +75 0 21 51 22 57 +76 0 21 15 22 51 +79 0 23 58 53 59 +80 0 23 58 52 53 +81 0 22 52 23 58 +82 0 22 16 23 52 +85 0 24 59 54 60 +91 0 26 61 56 62 +92 0 26 61 55 56 +93 0 25 55 26 61 +94 0 25 19 26 55 +95 0 26 55 20 56 +96 0 26 19 20 55 +97 0 27 62 57 63 +98 0 27 62 56 57 +99 0 26 56 27 62 +100 0 26 20 27 56 +101 0 27 56 21 57 +102 0 27 20 21 56 +103 0 28 63 58 64 +104 0 28 63 57 58 +105 0 27 57 28 63 +106 0 27 21 28 57 +107 0 28 57 22 58 +108 0 28 21 22 57 +109 0 29 64 59 65 +110 0 29 64 58 59 +111 0 28 58 29 64 +112 0 28 22 29 58 +113 0 29 58 23 59 +114 0 29 22 23 58 +115 0 30 65 60 66 +116 0 30 65 59 60 +117 0 29 59 30 65 +118 0 29 23 30 59 +119 0 30 59 24 60 +120 0 30 23 24 59 +121 0 32 67 62 68 +122 0 32 67 61 62 +123 0 31 61 32 67 +124 0 31 25 32 61 +125 0 32 61 26 62 +126 0 32 25 26 61 +127 0 33 68 63 69 +128 0 33 68 62 63 +129 0 32 62 33 68 +130 0 32 26 33 62 +131 0 33 62 27 63 +132 0 33 26 27 62 +133 0 34 69 64 70 +134 0 34 69 63 64 +135 0 33 63 34 69 +136 0 33 27 34 63 +137 0 34 63 28 64 +138 0 34 27 28 63 +139 0 35 70 65 71 +140 0 35 70 64 65 +141 0 34 64 35 70 +142 0 34 28 35 64 +143 0 35 64 29 65 +144 0 35 28 29 64 +145 0 36 71 66 72 +146 0 36 71 65 66 +147 0 35 65 36 71 +148 0 35 29 36 65 +149 0 36 65 30 66 +150 0 36 29 30 65 +End Elements +Begin Conditions WallCondition3D +6 0 19 49 55 +7 0 25 19 55 +8 0 25 55 61 +9 0 31 25 61 +10 0 31 61 67 +End Conditions +Begin Conditions WallCondition3D +16 0 24 60 54 +17 0 30 60 24 +18 0 30 66 60 +19 0 36 66 30 +20 0 36 72 66 +End Conditions +Begin Conditions WallCondition3D +End Conditions +Begin Conditions WallCondition3D +31 0 32 67 68 +32 0 32 31 67 +33 0 33 68 69 +34 0 33 32 68 +35 0 34 69 70 +36 0 34 33 69 +37 0 35 70 71 +38 0 35 34 70 +39 0 36 71 72 +40 0 36 35 71 +End Conditions +Begin Conditions WallCondition3D +61 0 19 20 13 +63 0 20 21 14 +65 0 21 22 15 +67 0 22 23 16 +69 0 23 24 17 +71 0 25 26 19 +72 0 26 20 19 +73 0 26 27 20 +74 0 27 21 20 +75 0 27 28 21 +76 0 28 22 21 +77 0 28 29 22 +78 0 29 23 22 +79 0 29 30 23 +80 0 30 24 23 +81 0 31 32 25 +82 0 32 26 25 +83 0 32 33 26 +84 0 33 27 26 +85 0 33 34 27 +86 0 34 28 27 +87 0 34 35 28 +88 0 35 29 28 +89 0 35 36 29 +90 0 36 30 29 +End Conditions +Begin Conditions WallCondition3D +112 0 55 50 56 +114 0 56 51 57 +116 0 57 52 58 +118 0 58 53 59 +120 0 59 54 60 +121 0 61 55 56 +122 0 61 56 62 +123 0 62 56 57 +124 0 62 57 63 +125 0 63 57 58 +126 0 63 58 64 +127 0 64 58 59 +128 0 64 59 65 +129 0 65 59 60 +130 0 65 60 66 +131 0 67 61 62 +132 0 67 62 68 +133 0 68 62 63 +134 0 68 63 69 +135 0 69 63 64 +136 0 69 64 70 +137 0 70 64 65 +138 0 70 65 71 +139 0 71 65 66 +140 0 71 66 72 +End Conditions +Begin SubModelPart Front +Begin SubModelPartNodes +13 +19 +25 +31 +49 +55 +61 +67 +End SubModelPartNodes +Begin SubModelPartConditions +6 +7 +8 +9 +10 +End SubModelPartConditions +End SubModelPart +Begin SubModelPart Back +Begin SubModelPartNodes +24 +30 +36 +54 +60 +66 +72 +End SubModelPartNodes +Begin SubModelPartConditions +16 +17 +18 +19 +20 +End SubModelPartConditions +End SubModelPart +Begin SubModelPart Right +Begin SubModelPartNodes +End SubModelPartNodes +Begin SubModelPartConditions +End SubModelPartConditions +End SubModelPart +Begin SubModelPart Left +Begin SubModelPartNodes +31 +32 +33 +34 +35 +36 +67 +68 +69 +70 +71 +72 +End SubModelPartNodes +Begin SubModelPartConditions +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +End SubModelPartConditions +End SubModelPart +Begin SubModelPart Bottom +Begin SubModelPartNodes +13 +14 +15 +16 +17 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +End SubModelPartNodes +Begin SubModelPartConditions +61 +63 +65 +67 +69 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +End SubModelPartConditions +End SubModelPart +Begin SubModelPart Top +Begin SubModelPartNodes +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +End SubModelPartNodes +Begin SubModelPartConditions +112 +114 +116 +118 +120 +121 +122 +123 +124 +125 +126 +127 +128 +129 +130 +131 +132 +133 +134 +135 +136 +137 +138 +139 +140 +End SubModelPartConditions +End SubModelPart +Begin NodalData PARTITION_INDEX +13 0 0 +14 0 0 +15 0 0 +16 0 0 +17 0 0 +19 0 1 +20 0 1 +21 0 1 +22 0 1 +23 0 1 +24 0 1 +25 0 1 +26 0 1 +27 0 1 +28 0 1 +29 0 1 +30 0 1 +31 0 1 +32 0 1 +33 0 1 +34 0 1 +35 0 1 +36 0 1 +49 0 0 +50 0 0 +51 0 0 +52 0 0 +53 0 0 +54 0 0 +55 0 1 +56 0 1 +57 0 1 +58 0 1 +59 0 1 +60 0 1 +61 0 1 +62 0 1 +63 0 1 +64 0 1 +65 0 1 +66 0 1 +67 0 1 +68 0 1 +69 0 1 +70 0 1 +71 0 1 +72 0 1 +End NodalData +Begin CommunicatorData +NEIGHBOURS_INDICES [4](0,-1,-1,-1) +NUMBER_OF_COLORS 1 + Begin LocalNodes 0 + 19 + 20 + 21 + 22 + 23 + 24 + 25 + 26 + 27 + 28 + 29 + 30 + 31 + 32 + 33 + 34 + 35 + 36 + 55 + 56 + 57 + 58 + 59 + 60 + 61 + 62 + 63 + 64 + 65 + 66 + 67 + 68 + 69 + 70 + 71 + 72 + End LocalNodes + Begin LocalNodes 1 + 19 + 20 + 21 + 22 + 23 + 24 + 55 + 56 + 57 + 58 + 59 + End LocalNodes + Begin GhostNodes 1 + 13 + 14 + 15 + 16 + 17 + 49 + 50 + 51 + 52 + 53 + 54 + End GhostNodes + Begin GhostNodes 0 + 13 + 14 + 15 + 16 + 17 + 49 + 50 + 51 + 52 + 53 + 54 + End GhostNodes +End CommunicatorData diff --git a/applications/FSIapplication/tests/FSIProblemEmulatorTest/FSIProblemEmulatorTest_Aitken_parameters.json b/applications/FSIapplication/tests/FSIProblemEmulatorTest/FSIProblemEmulatorTest_Aitken_parameters.json deleted file mode 100644 index c91c06cf740d..000000000000 --- a/applications/FSIapplication/tests/FSIProblemEmulatorTest/FSIProblemEmulatorTest_Aitken_parameters.json +++ /dev/null @@ -1,130 +0,0 @@ -{ - "structure_solver_settings" : { - "problem_data" : { - "problem_name" : "test_FSI_emulator", - "model_part_name" : "Structure", - "domain_size" : 2, - "time_step" : 0.1, - "start_time" : 0.0, - "end_time" : 1.0, - "echo_level" : 0 - }, - "solver_settings" : { - "solver_type" : "structural_mechanics_implicit_dynamic_solver", - "echo_level" : 0, - "solution_type" : "Dynamic", - "time_integration_method" : "Implicit", - "scheme_type" : "Bossak", - "model_import_settings" : { - "input_type" : "mdpa", - "input_filename" : "FSIProblemEmulatorTest/test_FSI_emulator_Structural", - "input_file_label" : 0 - }, - "material_import_settings" :{ - "materials_filename": "FSIProblemEmulatorTest/materials_2D.json" - }, - "line_search" : false, - "convergence_criterion" : "Residual_criterion", - "displacement_relative_tolerance" : 1e-8, - "displacement_absolute_tolerance" : 1e-10, - "residual_relative_tolerance" : 1e-8, - "residual_absolute_tolerance" : 1e-10, - "max_iteration" : 20, - "problem_domain_sub_model_part_list" : ["Parts_Solid"], - "processes_sub_model_part_list" : ["DISPLACEMENT_Displacement_BC","PointLoad2D_Point_load","StructureInterface2D_Solid_interface"], - "rotation_dofs" : false, - "linear_solver_settings" : { - "solver_type" : "SuperLUSolver", - "scaling" : true - } - }, - "intervals_list" : { - "Initial" : ["0.0","0.0"], - "Total" : ["0.0","End"], - "Custom1" : ["0.0","0.5"] - }, - "constraints_process_list" : [{ - "python_module" : "impose_vector_value_by_components_process", - "kratos_module" : "KratosMultiphysics", - "help" : "This process fixes the selected components of a given vector variable", - "process_name" : "ImposeVectorValueByComponentsProcess", - "Parameters" : { - "mesh_id" : 0, - "model_part_name" : "DISPLACEMENT_Displacement_BC", - "variable_name" : "DISPLACEMENT", - "is_fixed_x" : true, - "is_fixed_y" : true, - "is_fixed_z" : true, - "value" : [0.0,0.0,0.0] - } - }], - "loads_process_list" : [{ - "python_module" : "FSIProblemEmulatorTest_local_process", - "kratos_module" : "KratosMultiphysics.FSIApplication", - "process_name" : "ApplyLocalProcess", - "Parameters" : { - "model_part_name" : "PointLoad2D_Point_load", - "point_load_value": 10000 - } - },{ - "python_module" : "set_interface_process", - "kratos_module" : "KratosMultiphysics.FSIApplication", - "help" : [], - "process_name" : "SetInterfaceProcess", - "Parameters" : { - "mesh_id" : 0, - "model_part_name" : "StructureInterface2D_Solid_interface", - "variable_name" : "STRUCTURE_INTERFACE" - } - }], - "output_configuration" : { - "result_file_configuration" : { - "gidpost_flags" : { - "GiDPostMode" : "GiD_PostBinary", - "WriteDeformedMeshFlag" : "WriteDeformed", - "WriteConditionsFlag" : "WriteConditions", - "MultiFileFlag" : "SingleFile" - }, - "file_label" : "step", - "output_control_type" : "step", - "output_frequency" : 1.0, - "body_output" : true, - "node_output" : false, - "skin_output" : false, - "plane_output" : [], - "nodal_results" : ["DISPLACEMENT","REACTION","VELOCITY","ACCELERATION"], - "gauss_point_results" : ["GREEN_LAGRANGE_STRAIN_TENSOR","CAUCHY_STRESS_TENSOR","VON_MISES_STRESS"] - }, - "point_data_configuration" : [] - }, - "restart_options" : { - "SaveRestart" : false, - "RestartFrequency" : 0, - "LoadRestart" : false, - "Restart_Step" : 0 - }, - "constraints_data" : { - "incremental_load" : false, - "incremental_displacement" : false - } - }, - "coupling_solver_settings" : { - "solver_settings" : { - "coupling_scheme" : "DirichletNeumann", - "solver_type" : "partitioned_fsi_solver", - "nl_tol" : 1e-9, - "nl_max_it" : 50, - "move_interface" : true, - "mesh_prediction" : true, - "coupling_strategy" : { - "solver_type" : "Relaxation", - "acceleration_type" : "Aitken", - "w_0" : 0.825 - }, - "mesh_solver" : "mesh_solver_structural_similarity", - "mesh_reform_dofs_each_step" : false, - "structure_interfaces_list" : ["StructureInterface2D_Solid_interface"], - "fluid_interfaces_list" : ["FluidNoSlipInterface2D_Fluid_interface"] - } - } -} diff --git a/applications/FSIapplication/tests/FSIProblemEmulatorTest/FSIProblemEmulatorTest_MVQN_parameters.json b/applications/FSIapplication/tests/FSIProblemEmulatorTest/FSIProblemEmulatorTest_MVQN_parameters.json deleted file mode 100644 index e08d74738670..000000000000 --- a/applications/FSIapplication/tests/FSIProblemEmulatorTest/FSIProblemEmulatorTest_MVQN_parameters.json +++ /dev/null @@ -1,129 +0,0 @@ -{ - "structure_solver_settings" : { - "problem_data" : { - "problem_name" : "test_FSI_emulator", - "model_part_name" : "Structure", - "domain_size" : 2, - "time_step" : 0.1, - "start_time" : 0.0, - "end_time" : 1.0, - "echo_level" : 0 - }, - "solver_settings" : { - "solver_type" : "structural_mechanics_implicit_dynamic_solver", - "echo_level" : 0, - "solution_type" : "Dynamic", - "time_integration_method" : "Implicit", - "scheme_type" : "Bossak", - "model_import_settings" : { - "input_type" : "mdpa", - "input_filename" : "FSIProblemEmulatorTest/test_FSI_emulator_Structural", - "input_file_label" : 0 - }, - "material_import_settings" :{ - "materials_filename": "FSIProblemEmulatorTest/materials_2D.json" - }, - "line_search" : false, - "convergence_criterion" : "Residual_criterion", - "displacement_relative_tolerance" : 1e-8, - "displacement_absolute_tolerance" : 1e-10, - "residual_relative_tolerance" : 1e-8, - "residual_absolute_tolerance" : 1e-10, - "max_iteration" : 20, - "problem_domain_sub_model_part_list" : ["Parts_Solid"], - "processes_sub_model_part_list" : ["DISPLACEMENT_Displacement_BC","PointLoad2D_Point_load","StructureInterface2D_Solid_interface"], - "rotation_dofs" : false, - "linear_solver_settings" : { - "solver_type" : "SuperLUSolver", - "scaling" : true - } - }, - "intervals_list" : { - "Initial" : ["0.0","0.0"], - "Total" : ["0.0","End"], - "Custom1" : ["0.0","0.5"] - }, - "constraints_process_list" : [{ - "python_module" : "impose_vector_value_by_components_process", - "kratos_module" : "KratosMultiphysics", - "help" : "This process fixes the selected components of a given vector variable", - "process_name" : "ImposeVectorValueByComponentsProcess", - "Parameters" : { - "mesh_id" : 0, - "model_part_name" : "DISPLACEMENT_Displacement_BC", - "variable_name" : "DISPLACEMENT", - "is_fixed_x" : true, - "is_fixed_y" : true, - "is_fixed_z" : true, - "value" : [0.0,0.0,0.0] - } - }], - "loads_process_list" : [{ - "python_module" : "FSIProblemEmulatorTest_local_process", - "kratos_module" : "KratosMultiphysics.FSIApplication", - "process_name" : "ApplyLocalProcess", - "Parameters" : { - "model_part_name" : "PointLoad2D_Point_load", - "point_load_value": 10000 - } - },{ - "python_module" : "set_interface_process", - "kratos_module" : "KratosMultiphysics.FSIApplication", - "help" : [], - "process_name" : "SetInterfaceProcess", - "Parameters" : { - "mesh_id" : 0, - "model_part_name" : "StructureInterface2D_Solid_interface", - "variable_name" : "STRUCTURE_INTERFACE" - } - }], - "output_configuration" : { - "result_file_configuration" : { - "gidpost_flags" : { - "GiDPostMode" : "GiD_PostBinary", - "WriteDeformedMeshFlag" : "WriteDeformed", - "WriteConditionsFlag" : "WriteConditions", - "MultiFileFlag" : "SingleFile" - }, - "file_label" : "step", - "output_control_type" : "step", - "output_frequency" : 1.0, - "body_output" : true, - "node_output" : false, - "skin_output" : false, - "plane_output" : [], - "nodal_results" : ["DISPLACEMENT","REACTION","VELOCITY","ACCELERATION"], - "gauss_point_results" : ["GREEN_LAGRANGE_STRAIN_TENSOR","CAUCHY_STRESS_TENSOR","VON_MISES_STRESS"] - }, - "point_data_configuration" : [] - }, - "restart_options" : { - "SaveRestart" : false, - "RestartFrequency" : 0, - "LoadRestart" : false, - "Restart_Step" : 0 - }, - "constraints_data" : { - "incremental_load" : false, - "incremental_displacement" : false - } - }, - "coupling_solver_settings" : { - "solver_settings" : { - "coupling_scheme" : "DirichletNeumann", - "solver_type" : "partitioned_fsi_solver", - "nl_tol" : 1e-9, - "nl_max_it" : 50, - "move_interface" : true, - "mesh_prediction" : true, - "coupling_strategy" : { - "solver_type" : "MVQN", - "w_0" : 0.825 - }, - "mesh_solver" : "mesh_solver_structural_similarity", - "mesh_reform_dofs_each_step" : false, - "structure_interfaces_list" : ["StructureInterface2D_Solid_interface"], - "fluid_interfaces_list" : ["FluidNoSlipInterface2D_Fluid_interface"] - } - } -} diff --git a/applications/FSIapplication/tests/FSIProblemEmulatorTest/FSIProblemEmulatorTest_MVQN_recursive_parameters.json b/applications/FSIapplication/tests/FSIProblemEmulatorTest/FSIProblemEmulatorTest_MVQN_recursive_parameters.json deleted file mode 100644 index 333136fc4747..000000000000 --- a/applications/FSIapplication/tests/FSIProblemEmulatorTest/FSIProblemEmulatorTest_MVQN_recursive_parameters.json +++ /dev/null @@ -1,130 +0,0 @@ -{ - "structure_solver_settings" : { - "problem_data" : { - "problem_name" : "test_FSI_emulator", - "model_part_name" : "Structure", - "domain_size" : 2, - "time_step" : 0.1, - "start_time" : 0.0, - "end_time" : 1.0, - "echo_level" : 0 - }, - "solver_settings" : { - "solver_type" : "structural_mechanics_implicit_dynamic_solver", - "echo_level" : 0, - "solution_type" : "Dynamic", - "time_integration_method" : "Implicit", - "scheme_type" : "Bossak", - "model_import_settings" : { - "input_type" : "mdpa", - "input_filename" : "FSIProblemEmulatorTest/test_FSI_emulator_Structural", - "input_file_label" : 0 - }, - "material_import_settings" :{ - "materials_filename": "FSIProblemEmulatorTest/materials_2D.json" - }, - "line_search" : false, - "convergence_criterion" : "Residual_criterion", - "displacement_relative_tolerance" : 1e-8, - "displacement_absolute_tolerance" : 1e-10, - "residual_relative_tolerance" : 1e-8, - "residual_absolute_tolerance" : 1e-10, - "max_iteration" : 20, - "problem_domain_sub_model_part_list" : ["Parts_Solid"], - "processes_sub_model_part_list" : ["DISPLACEMENT_Displacement_BC","PointLoad2D_Point_load","StructureInterface2D_Solid_interface"], - "rotation_dofs" : false, - "linear_solver_settings" : { - "solver_type" : "SuperLUSolver", - "scaling" : true - } - }, - "intervals_list" : { - "Initial" : ["0.0","0.0"], - "Total" : ["0.0","End"], - "Custom1" : ["0.0","0.5"] - }, - "constraints_process_list" : [{ - "python_module" : "impose_vector_value_by_components_process", - "kratos_module" : "KratosMultiphysics", - "help" : "This process fixes the selected components of a given vector variable", - "process_name" : "ImposeVectorValueByComponentsProcess", - "Parameters" : { - "mesh_id" : 0, - "model_part_name" : "DISPLACEMENT_Displacement_BC", - "variable_name" : "DISPLACEMENT", - "is_fixed_x" : true, - "is_fixed_y" : true, - "is_fixed_z" : true, - "value" : [0.0,0.0,0.0] - } - }], - "loads_process_list" : [{ - "python_module" : "FSIProblemEmulatorTest_local_process", - "kratos_module" : "KratosMultiphysics.FSIApplication", - "process_name" : "ApplyLocalProcess", - "Parameters" : { - "model_part_name" : "PointLoad2D_Point_load", - "point_load_value": 10000 - } - },{ - "python_module" : "set_interface_process", - "kratos_module" : "KratosMultiphysics.FSIApplication", - "help" : [], - "process_name" : "SetInterfaceProcess", - "Parameters" : { - "mesh_id" : 0, - "model_part_name" : "StructureInterface2D_Solid_interface", - "variable_name" : "STRUCTURE_INTERFACE" - } - }], - "output_configuration" : { - "result_file_configuration" : { - "gidpost_flags" : { - "GiDPostMode" : "GiD_PostBinary", - "WriteDeformedMeshFlag" : "WriteDeformed", - "WriteConditionsFlag" : "WriteConditions", - "MultiFileFlag" : "SingleFile" - }, - "file_label" : "step", - "output_control_type" : "step", - "output_frequency" : 1.0, - "body_output" : true, - "node_output" : false, - "skin_output" : false, - "plane_output" : [], - "nodal_results" : ["DISPLACEMENT","REACTION","VELOCITY","ACCELERATION"], - "gauss_point_results" : ["GREEN_LAGRANGE_STRAIN_TENSOR","CAUCHY_STRESS_TENSOR","VON_MISES_STRESS"] - }, - "point_data_configuration" : [] - }, - "restart_options" : { - "SaveRestart" : false, - "RestartFrequency" : 0, - "LoadRestart" : false, - "Restart_Step" : 0 - }, - "constraints_data" : { - "incremental_load" : false, - "incremental_displacement" : false - } - }, - "coupling_solver_settings" : { - "solver_settings" : { - "coupling_scheme" : "DirichletNeumann", - "solver_type" : "partitioned_fsi_solver", - "nl_tol" : 1e-9, - "nl_max_it" : 50, - "move_interface" : true, - "mesh_prediction" : true, - "coupling_strategy" : { - "solver_type" : "MVQN_recursive", - "buffer_size" : 5, - "w_0" : 0.825 - }, - "mesh_solver" : "mesh_solver_structural_similarity", - "mesh_reform_dofs_each_step" : false, - "structure_interfaces_list" : ["StructureInterface2D_Solid_interface"], - "fluid_interfaces_list" : ["FluidNoSlipInterface2D_Fluid_interface"] - } - } -} diff --git a/applications/FSIapplication/tests/FSIProblemEmulatorTest_local_process.py b/applications/FSIapplication/tests/FSIProblemEmulatorTest_local_process.py deleted file mode 100644 index acdb4468ab6f..000000000000 --- a/applications/FSIapplication/tests/FSIProblemEmulatorTest_local_process.py +++ /dev/null @@ -1,58 +0,0 @@ -from __future__ import print_function, absolute_import, division #makes KratosMultiphysics backward compatible with python 2.6 and 2.7 - -# Importing the Kratos Library -import KratosMultiphysics -import KratosMultiphysics.StructuralMechanicsApplication as KratosStructural -import KratosMultiphysics.FSIApplication as KratosFSI - -KratosMultiphysics.CheckForPreviousImport() - -# Import KratosUnittest -import KratosMultiphysics.KratosUnittest as KratosUnittest - -def Factory(settings, Model): - if(type(settings) != KratosMultiphysics.Parameters): - raise Exception("Expected input shall be a Parameters object, encapsulating a json string") - return ApplyLocalProcess(Model, settings["Parameters"]) - -class ApplyLocalProcess(KratosMultiphysics.Process, KratosUnittest.TestCase): - - def __init__(self,model_part,params): - - self.punctual_load_submodelpart = model_part[params["model_part_name"].GetString()] - self.params = params - self.updater = 1.5 - - - def ExecuteInitialize(self): - - # Set the initial punctual load value - for node in self.punctual_load_submodelpart.Nodes: - node.SetSolutionStepValue(KratosStructural.POINT_LOAD_X, 0, self.params["point_load_value"].GetDouble()) - - - def ExecuteBeforeSolutionLoop(self): - pass - - - def ExecuteInitializeSolutionStep(self): - - # Set the initial punctual load value - for node in self.punctual_load_submodelpart.Nodes: - node.SetSolutionStepValue(KratosStructural.POINT_LOAD_X, 0, self.updater*(self.params["point_load_value"].GetDouble())) - - - def ExecuteFinalizeSolutionStep(self): - pass - - - def ExecuteBeforeOutputStep(self): - pass - - - def ExecuteAfterOutputStep(self): - pass - - - def ExecuteFinalize(self): - pass diff --git a/applications/FSIapplication/tests/FSI_problem_emulator_test.py b/applications/FSIapplication/tests/FSI_problem_emulator_test.py new file mode 100644 index 000000000000..2caa6cfe6e0f --- /dev/null +++ b/applications/FSIapplication/tests/FSI_problem_emulator_test.py @@ -0,0 +1,252 @@ +from KratosMultiphysics import * +from KratosMultiphysics.FSIApplication import * + +import KratosMultiphysics.KratosUnittest as UnitTest + +from os import remove + +try: + from KratosMultiphysics.StructuralMechanicsApplication import * + missing_external_dependencies = False + missing_application = '' +except ImportError as e: + missing_external_dependencies = True + # extract name of the missing application from the error message + import re + missing_application = re.search(r'''.*'KratosMultiphysics\.(.*)'.*''','{0}'.format(e)).group(1) + +class WorkFolderScope: + def __init__(self, work_folder): + self.currentPath = os.getcwd() + self.scope = os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__)),work_folder)) + + def __enter__(self): + os.chdir(self.scope) + + def __exit__(self, type, value, traceback): + os.chdir(self.currentPath) + +class FSIProblemEmulatorTest(UnitTest.TestCase): + + def setUp(self): + self.work_folder = "FSIProblemEmulatorTest" + self.input_file = "test_FSI_emulator_Structural" + + self.Dt = 0.1 + self.end_time = 1.0 + + self.point_load_updater = 1.5 + self.initial_point_load = 10000 + + self.nl_tol = 1.0e-9 + self.max_nl_it = 50 + self.initial_relaxation = 0.825 + + def tearDown(self): + self.deleteOutFile(self.input_file+'.time') + + def deleteOutFile(self,filename): + with WorkFolderScope(self.work_folder): + try: + remove(filename) + except FileNotFoundError as e: + pass + + def testFSIProblemEmulatorWithAitken(self): + self.coupling_utility = AitkenConvergenceAccelerator(self.initial_relaxation) + self.RunTestCase() + + def testFSIProblemEmulatorWithMVQN(self): + self.coupling_utility = MVQNFullJacobianConvergenceAccelerator(self.initial_relaxation) + self.RunTestCase() + + def testFSIProblemEmulatorWithMVQNRecursive(self): + buffer_size = 7 + self.coupling_utility = MVQNRecursiveJacobianConvergenceAccelerator(self.initial_relaxation, buffer_size) + self.RunTestCase() + + def RunTestCase(self): + StructureSolverSettings = Parameters(""" + { + "solver_type" : "structural_mechanics_implicit_dynamic_solver", + "echo_level" : 0, + "solution_type" : "Dynamic", + "time_integration_method" : "Implicit", + "scheme_type" : "Bossak", + "model_import_settings" : { + "input_type" : "mdpa", + "input_filename" : "test_FSI_emulator_Structural", + "input_file_label" : 0 + }, + "material_import_settings" :{ + "materials_filename": "materials_2D.json" + }, + "line_search" : false, + "convergence_criterion" : "Residual_criterion", + "displacement_relative_tolerance" : 1e-8, + "displacement_absolute_tolerance" : 1e-10, + "residual_relative_tolerance" : 1e-8, + "residual_absolute_tolerance" : 1e-10, + "max_iteration" : 20, + "problem_domain_sub_model_part_list" : ["Parts_Solid"], + "processes_sub_model_part_list" : ["DISPLACEMENT_Displacement_BC","PointLoad2D_Point_load","StructureInterface2D_Solid_interface"], + "rotation_dofs" : false, + "linear_solver_settings" : { + "solver_type" : "SuperLUSolver", + "scaling" : true + } + } + """) + + with WorkFolderScope(self.work_folder): + + self.structure_main_model_part = ModelPart("Structure") + self.structure_main_model_part.ProcessInfo.SetValue(DOMAIN_SIZE, 2) + + # Construct the structure solver + structure_solver_module = __import__(StructureSolverSettings["solver_type"].GetString()) + self.structure_solver = structure_solver_module.CreateSolver(self.structure_main_model_part, StructureSolverSettings) + + self.structure_solver.AddVariables() + + self.structure_solver.ImportModelPart() + + self.structure_solver.AddDofs() + + self.SetStructureBoundaryConditions() + + self.structure_solver.Initialize() + + self.coupling_utility.Initialize() + + residual_size = self.GetInterfaceProblemSize()*2 # Interface DOFs number times PROBLEM_SIZE + self.iteration_value = Vector(residual_size) # Interface solution guess (it might be velocity or fluxes depending on the type of coupling) + for i in range(0,residual_size): + self.iteration_value[i] = 0.0 + + step = 0 + time = 0.0 + + while(time <= self.end_time): + + time = time + self.Dt + step = step + 1 + + self.structure_solver.main_model_part.ProcessInfo.SetValue(TIME_STEPS, step) + + self.structure_main_model_part.CloneTimeStep(time) + + self.PointLoadUpdate() + + self.structure_solver.InitializeSolutionStep() + self.structure_solver.Predict() + + self.coupling_utility.InitializeSolutionStep() + + for nl_it in range(1,self.max_nl_it+1): + + self.coupling_utility.InitializeNonLinearIteration() + + # Residual computation + disp_residual = self.ComputeDirichletNeumannResidual() + nl_res_norm = UblasSparseSpace().TwoNorm(disp_residual) + + # Check convergence + if nl_res_norm < self.nl_tol: + break + + else: + # If convergence is not achieved, perform the correction of the prediction + self.coupling_utility.UpdateSolution(disp_residual, self.iteration_value) + self.coupling_utility.FinalizeNonLinearIteration() + + self.structure_solver.FinalizeSolutionStep() + self.coupling_utility.FinalizeSolutionStep() + + # Unitcest convergence criterion check + self.assertLess(nl_res_norm, self.nl_tol) + + def SetStructureBoundaryConditions(self): + zero_vect = Vector(3) + zero_vect[0] = 0.0 + zero_vect[1] = 0.0 + zero_vect[2] = 0.0 + + # Constraint boundary condition + for node in self.structure_main_model_part.GetSubModelPart("DISPLACEMENT_Displacement_BC").Nodes: + node.SetSolutionStepValue(DISPLACEMENT, 0, zero_vect) + node.Fix(DISPLACEMENT_X) + node.Fix(DISPLACEMENT_Y) + node.Fix(DISPLACEMENT_Z) + + # Set initial point load value + for node in self.structure_main_model_part.GetSubModelPart("PointLoad2D_Point_load").Nodes: + node.SetSolutionStepValue(POINT_LOAD_X, 0, self.initial_point_load) + + # Set the structure interface + for node in self.structure_main_model_part.GetSubModelPart("StructureInterface2D_Solid_interface").Nodes: + node.Set(INTERFACE) + + # Set structure Neumann condition (create the point load condition in the structure interface submodelpart) + structure_computational_submodelpart = self.structure_solver.GetComputingModelPart() + + aux_count = 0 + for cond in self.structure_solver.main_model_part.Conditions: + if(cond.Id > aux_count): + aux_count = cond.Id + + for node in self.structure_main_model_part.GetSubModelPart("StructureInterface2D_Solid_interface").Nodes: + aux_count+=1 + structure_computational_submodelpart.CreateNewCondition("PointLoadCondition2D1N", + aux_count,[node.Id], + self.structure_solver.main_model_part.Properties[0]) + + def PointLoadUpdate(self): + for node in self.structure_main_model_part.GetSubModelPart("PointLoad2D_Point_load").Nodes: + point_load = node.GetSolutionStepValue(POINT_LOAD_X) + node.SetSolutionStepValue(POINT_LOAD_X, 0, self.point_load_updater*point_load) + + def GetInterfaceProblemSize(self): + return len(self.structure_solver.main_model_part.GetSubModelPart("StructureInterface2D_Solid_interface").Nodes) + + def ComputeDirichletNeumannResidual(self): + + interface_submodelpart = self.structure_solver.main_model_part.GetSubModelPart("StructureInterface2D_Solid_interface") + + K = 1000.0 # Spring stiffness + + # Impose the spring reactions that emulate the fluid load over the structure interface + i = 0 + for node in interface_submodelpart.Nodes: + point_load = Vector(3) + point_load[0] = - K*self.iteration_value[i] + point_load[1] = - K*self.iteration_value[i+1] + point_load[2] = 0.0 + + node.SetSolutionStepValue(POINT_LOAD, 0, point_load) + + i += 2 + + # Solve structure problem + self.structure_solver.SolveSolutionStep() + + # Compute the displacement residual + disp_residual = Vector(self.GetInterfaceProblemSize()*2) + + i = 0 + for node in interface_submodelpart.Nodes: + vector_projected = node.GetSolutionStepValue(DISPLACEMENT,0) + + disp_residual[i] = vector_projected[0] - self.iteration_value[i] + disp_residual[i+1] = vector_projected[1] - self.iteration_value[i+1] + i+=2 + + return disp_residual + +if __name__ == '__main__': + test = FSIProblemEmulatorTest() + test.setUp() + # test.testFSIProblemEmulatorWithAitken() + # test.testFSIProblemEmulatorWithMVQN() + test.testFSIProblemEmulatorWithMVQNRecursive() + test.tearDown() diff --git a/applications/FSIapplication/tests/KratosExecuteFSIProblemEmulatorTest.py b/applications/FSIapplication/tests/KratosExecuteFSIProblemEmulatorTest.py deleted file mode 100644 index 19e313288ae5..000000000000 --- a/applications/FSIapplication/tests/KratosExecuteFSIProblemEmulatorTest.py +++ /dev/null @@ -1,202 +0,0 @@ -from __future__ import print_function, absolute_import, division # makes KratosMultiphysics backward compatible with python 2.6 and 2.7 - -# Import kratos core and applications -import KratosMultiphysics -import KratosMultiphysics.FSIApplication as KratosFSI -try: - import KratosMultiphysics.ALEApplication as KratosALE - import KratosMultiphysics.FluidDynamicsApplication as KratosFluid - import KratosMultiphysics.StructuralMechanicsApplication as KratosStructural -except ImportError as e: - pass - -import process_factory -import KratosMultiphysics.KratosUnittest as KratosUnittest - -class KratosExecuteFSIProblemEmulatorTest(KratosUnittest.TestCase): - - def __init__(self, ProjectParameters): - - self.ProjectParameters = ProjectParameters - - self.vector_space = KratosMultiphysics.UblasSparseSpace() - - self.structure_main_model_part = KratosMultiphysics.ModelPart(self.ProjectParameters["structure_solver_settings"]["problem_data"]["model_part_name"].GetString()) - self.structure_main_model_part.ProcessInfo.SetValue(KratosMultiphysics.DOMAIN_SIZE, self.ProjectParameters["structure_solver_settings"]["problem_data"]["domain_size"].GetInt()) - - SolidModel = {ProjectParameters["structure_solver_settings"]["problem_data"]["model_part_name"].GetString() : self.structure_main_model_part} - - # Construct the structure solver - structure_solver_module = __import__(self.ProjectParameters["structure_solver_settings"]["solver_settings"]["solver_type"].GetString()) - self.structure_solver = structure_solver_module.CreateSolver(self.structure_main_model_part, - self.ProjectParameters["structure_solver_settings"]["solver_settings"]) - print("* Structure solver constructed.") - - # Construct the coupling partitioned strategy - import convergence_accelerator_factory - self.coupling_utility = convergence_accelerator_factory.CreateConvergenceAccelerator(self.ProjectParameters["coupling_solver_settings"]["solver_settings"]["coupling_strategy"]) - print("* Coupling strategy constructed.") - - self.structure_solver.AddVariables() - - self.structure_solver.ImportModelPart() - - self.structure_solver.AddDofs() - - # Get the structure process list - for i in range(self.ProjectParameters["structure_solver_settings"]["solver_settings"]["processes_sub_model_part_list"].size()): - part_name = self.ProjectParameters["structure_solver_settings"]["solver_settings"]["processes_sub_model_part_list"][i].GetString() - SolidModel.update({part_name: self.structure_main_model_part.GetSubModelPart(part_name)}) - - # Structure processes construction - import process_factory - self.list_of_processes = process_factory.KratosProcessFactory(SolidModel).ConstructListOfProcesses( self.ProjectParameters["structure_solver_settings"]["constraints_process_list"] ) - self.list_of_processes += process_factory.KratosProcessFactory(SolidModel).ConstructListOfProcesses( self.ProjectParameters["structure_solver_settings"]["loads_process_list"] ) - - # Processes initialization - for process in self.list_of_processes: - process.ExecuteInitialize() - - # Structure solver initialization - self.structure_solver.Initialize() - self._SetStructureNeumannCondition() - - # Coupling utility initialization - self.coupling_utility.Initialize() - - - def Solve(self): - - self.structure_solver.Initialize() - - # Stepping and time settings - Dt = self.ProjectParameters["structure_solver_settings"]["problem_data"]["time_step"].GetDouble() - end_time = self.ProjectParameters["structure_solver_settings"]["problem_data"]["end_time"].GetDouble() - - # Coupling convergence parameters - nl_tol = self.ProjectParameters["coupling_solver_settings"]["solver_settings"]["nl_tol"].GetDouble() - max_nl_it = self.ProjectParameters["coupling_solver_settings"]["solver_settings"]["nl_max_it"].GetInt() - - time = 0.0 - step = 0 - - residual_size = self._GetInterfaceProblemSize()*2 # Interface DOFs number times PROBLEM_SIZE - self.iteration_value = KratosMultiphysics.Vector(residual_size) # Interface solution guess (it might be velocity or fluxes depending on the type of coupling) - - for i in range(0,residual_size): - self.iteration_value[i] = 0.0 - - for process in self.list_of_processes: - process.ExecuteBeforeSolutionLoop() - - while(time <= end_time): - - time = time + Dt - step = step + 1 - - self.structure_solver.main_model_part.ProcessInfo.SetValue(KratosMultiphysics.TIME_STEPS, step) - - self.structure_main_model_part.CloneTimeStep(time) - - print("STEP = ", step) - print("TIME = ", time) - - for process in self.list_of_processes: - process.ExecuteInitializeSolutionStep() - - self.structure_solver.InitializeSolutionStep() - self.structure_solver.Predict() - - self.coupling_utility.InitializeSolutionStep() - - for nl_it in range(1,max_nl_it+1): - - self.coupling_utility.InitializeNonLinearIteration() - - # Residual computation - disp_residual = self._ComputeDirichletNeumannResidual() - nl_res_norm = self.vector_space.TwoNorm(disp_residual) - - # Check convergence - if nl_res_norm < nl_tol: - break - - else: - # If convergence is not achieved, perform the correction of the prediction - self.coupling_utility.UpdateSolution(disp_residual, self.iteration_value) - self.coupling_utility.FinalizeNonLinearIteration() - - self.structure_solver.FinalizeSolutionStep() - self.coupling_utility.FinalizeSolutionStep() - - for process in self.list_of_processes: - process.ExecuteFinalizeSolutionStep() - - # Unitcest convergence criterion check - self.assertLess(nl_res_norm, nl_tol) - - for process in self.list_of_processes: - process.ExecuteFinalize() - - - ### PRIVATE METHODS SECTION ### - def _GetInterfaceProblemSize(self): - - # Get the structure interface problem size - interface_submodelpart_name = self.ProjectParameters["coupling_solver_settings"]["solver_settings"]["structure_interfaces_list"][0].GetString() - structure_interface_pb_size = len(self.structure_solver.main_model_part.GetSubModelPart(interface_submodelpart_name).Nodes) - - return structure_interface_pb_size - - - def _SetStructureNeumannCondition(self): - - structure_computational_submodelpart = self.structure_solver.GetComputingModelPart() - - aux_count = 0 - for cond in self.structure_solver.main_model_part.Conditions: - if(cond.Id > aux_count): - aux_count = cond.Id - - interface_submodelpart_name = self.ProjectParameters["coupling_solver_settings"]["solver_settings"]["structure_interfaces_list"][0].GetString() - interface_submodelpart_i = self.structure_solver.main_model_part.GetSubModelPart(interface_submodelpart_name) - - # Create the point load condition in the structure interface submodelpart - for node in interface_submodelpart_i.Nodes: - aux_count+=1 - structure_computational_submodelpart.CreateNewCondition("PointLoadCondition2D1N",aux_count,[node.Id],self.structure_solver.main_model_part.Properties[0]) - - - def _ComputeDirichletNeumannResidual(self): - - interface_submodelpart_name = self.ProjectParameters["coupling_solver_settings"]["solver_settings"]["structure_interfaces_list"][0].GetString() - - K = 1000.0 # Spring stiffness - - # Impose the spring reactions that emulate the fluid load over the structure interface - i = 0 - for node in self.structure_solver.main_model_part.GetSubModelPart(interface_submodelpart_name).Nodes: - point_load = KratosMultiphysics.Vector(3) - point_load[0] = - K*self.iteration_value[i] - point_load[1] = - K*self.iteration_value[i+1] - point_load[2] = 0.0 - - node.SetSolutionStepValue(KratosStructural.POINT_LOAD, 0, point_load) - - i += 2 - - # Solve structure problem - self.structure_solver.SolveSolutionStep() - - # Compute the displacement residual - disp_residual = KratosMultiphysics.Vector(self._GetInterfaceProblemSize()*2) - - i = 0 - for node in self.structure_solver.main_model_part.GetSubModelPart(interface_submodelpart_name).Nodes: - vector_projected = node.GetSolutionStepValue(KratosMultiphysics.DISPLACEMENT,0) - - disp_residual[i] = vector_projected[0] - self.iteration_value[i] - disp_residual[i+1] = vector_projected[1] - self.iteration_value[i+1] - i+=2 - - return disp_residual diff --git a/applications/FSIapplication/tests/KratosExecuteMapperTest.py b/applications/FSIapplication/tests/KratosExecuteMapperTest.py deleted file mode 100644 index 308eb7fb714d..000000000000 --- a/applications/FSIapplication/tests/KratosExecuteMapperTest.py +++ /dev/null @@ -1,166 +0,0 @@ -from __future__ import print_function, absolute_import, division # makes KratosMultiphysics backward compatible with python 2.6 and 2.7 - -from KratosMultiphysics import * -from KratosMultiphysics.FSIApplication import * -try: - from KratosMultiphysics.ALEApplication import * - from KratosMultiphysics.FluidDynamicsApplication import * - from KratosMultiphysics.StructuralMechanicsApplication import * -except ImportError: - pass - -import os -import process_factory -import NonConformant_OneSideMap - -class KratosExecuteMapperTest: - - def __init__(self, ProjectParameters): - - # Json format solvers settings - ProjectParametersFluid = ProjectParameters["fluid_solver_settings"] - ProjectParametersSolid = ProjectParameters["structure_solver_settings"] - - # Defining a model part for the fluid and one for the structure - self.structure_main_model_part = ModelPart("structure_part") - self.fluid_main_model_part = ModelPart("fluid_part") - - # Set the domain size (2D or 3D test) - self.structure_main_model_part.ProcessInfo.SetValue(DOMAIN_SIZE, ProjectParametersFluid["problem_data"]["domain_size"].GetInt()) - self.fluid_main_model_part.ProcessInfo.SetValue(DOMAIN_SIZE, ProjectParametersSolid["problem_data"]["domain_size"].GetInt()) - - # Set the fluid and solid models - FluidModel = {ProjectParametersFluid["problem_data"]["model_part_name"].GetString() : self.structure_main_model_part} - SolidModel = {ProjectParametersSolid["problem_data"]["model_part_name"].GetString() : self.fluid_main_model_part} - - # Fluid model part variables addition - self.fluid_main_model_part.AddNodalSolutionStepVariable(VELOCITY) - self.fluid_main_model_part.AddNodalSolutionStepVariable(PRESSURE) - self.fluid_main_model_part.AddNodalSolutionStepVariable(REACTION) - - # Structure model part variables addition - self.structure_main_model_part.AddNodalSolutionStepVariable(VELOCITY) - self.structure_main_model_part.AddNodalSolutionStepVariable(PRESSURE) - self.structure_main_model_part.AddNodalSolutionStepVariable(POINT_LOAD) - - # Mapper variables addition - NonConformant_OneSideMap.AddVariables(self.fluid_main_model_part, self.structure_main_model_part) - - # Fluid domain model reading - ModelPartIO(ProjectParametersFluid["solver_settings"]["model_import_settings"]["input_filename"].GetString()).ReadModelPart(self.fluid_main_model_part) - prepare_model_part_settings_fluid = Parameters("{}") - prepare_model_part_settings_fluid.AddValue("volume_model_part_name",ProjectParametersFluid["solver_settings"]["volume_model_part_name"]) - prepare_model_part_settings_fluid.AddValue("skin_parts",ProjectParametersFluid["solver_settings"]["skin_parts"]) - import check_and_prepare_model_process_fluid - check_and_prepare_model_process_fluid.CheckAndPrepareModelProcess(self.fluid_main_model_part, prepare_model_part_settings_fluid).Execute() - - # Solid domain model reading - computing_model_part_name = "computing_domain" - ModelPartIO(ProjectParametersSolid["solver_settings"]["model_import_settings"]["input_filename"].GetString()).ReadModelPart(self.structure_main_model_part) - prepare_model_part_settings_structure = Parameters("{}") - prepare_model_part_settings_structure.AddEmptyValue("computing_model_part_name").SetString(computing_model_part_name) - prepare_model_part_settings_structure.AddValue("problem_domain_sub_model_part_list",ProjectParametersSolid["solver_settings"]["problem_domain_sub_model_part_list"]) - prepare_model_part_settings_structure.AddValue("processes_sub_model_part_list",ProjectParametersSolid["solver_settings"]["processes_sub_model_part_list"]) - import check_and_prepare_model_process_structural - check_and_prepare_model_process_structural.CheckAndPrepareModelProcess(self.structure_main_model_part, prepare_model_part_settings_structure).Execute() - - # Get the list of the skin submodel parts where the fluid interface submodel part is stored - for i in range(ProjectParametersFluid["solver_settings"]["skin_parts"].size()): - skin_part_name = ProjectParametersFluid["solver_settings"]["skin_parts"][i].GetString() - FluidModel.update({skin_part_name: self.fluid_main_model_part.GetSubModelPart(skin_part_name)}) - - # Get the list of the submodel parts where the structure interface is stored - for i in range(ProjectParametersSolid["solver_settings"]["processes_sub_model_part_list"].size()): - part_name = ProjectParametersSolid["solver_settings"]["processes_sub_model_part_list"][i].GetString() - SolidModel.update({part_name: self.structure_main_model_part.GetSubModelPart(part_name)}) - - # Construct processes - self.list_of_processes = process_factory.KratosProcessFactory(FluidModel).ConstructListOfProcesses( ProjectParametersFluid["boundary_conditions_process_list"] ) - self.list_of_processes += process_factory.KratosProcessFactory(SolidModel).ConstructListOfProcesses( ProjectParametersSolid["constraints_process_list"] ) - - # Set fluid and structure interfaces - for node in self.fluid_main_model_part.GetSubModelPart("Fluid_interface").Nodes: - node.Set(INTERFACE, True) - for node in self.structure_main_model_part.GetSubModelPart("Structure_interface").Nodes: - node.Set(INTERFACE, True) - - for process in self.list_of_processes: - process.ExecuteInitialize() - - # Mapper construction - search_radius_factor = 2.0 - mapper_max_iterations = 200 - mapper_tolerance = 1e-12 - self.mapper = NonConformant_OneSideMap.NonConformant_OneSideMap(self.fluid_main_model_part, - self.structure_main_model_part, - search_radius_factor, - mapper_max_iterations, - mapper_tolerance) - - # Output settings - self.output_post = False # Set this variable to True if it is need to print the results for debugging purposes - self.problem_path = os.getcwd() - - if (self.output_post == True): - from gid_output_process import GiDOutputProcess - - self.gid_output_structure = GiDOutputProcess(self.structure_main_model_part, - ProjectParametersSolid["problem_data"]["problem_name"].GetString()+"_structure", - ProjectParametersSolid["output_configuration"]) - - self.gid_output_fluid = GiDOutputProcess(self.fluid_main_model_part, - ProjectParametersFluid["problem_data"]["problem_name"].GetString()+"_fluid", - ProjectParametersFluid["output_configuration"]) - - self.gid_output_structure.ExecuteInitialize() - self.gid_output_fluid.ExecuteInitialize() - - def Solve(self): - - for process in self.list_of_processes: - process.ExecuteBeforeSolutionLoop() - - if (self.output_post == True): - self.gid_output_structure.ExecuteBeforeSolutionLoop() - self.gid_output_fluid.ExecuteBeforeSolutionLoop() - - self.structure_main_model_part.ProcessInfo[TIME_STEPS] = 1 - self.structure_main_model_part.CloneTimeStep(1.0) - self.fluid_main_model_part.ProcessInfo[TIME_STEPS] = 1 - self.fluid_main_model_part.CloneTimeStep(1.0) - - for process in self.list_of_processes: - process.ExecuteInitializeSolutionStep() - - if (self.output_post == True): - self.gid_output_structure.ExecuteInitializeSolutionStep() - self.gid_output_fluid.ExecuteInitializeSolutionStep() - - # Solve: Information transfer - self.mapper.FluidToStructure_ScalarMap(PRESSURE, PRESSURE, True) - self.mapper.FluidToStructure_VectorMap(REACTION, POINT_LOAD, True, True) - self.mapper.StructureToFluid_VectorMap(VELOCITY, VELOCITY, True, False) - - if (self.output_post == True): - self.gid_output_structure.ExecuteFinalizeSolutionStep() - self.gid_output_fluid.ExecuteFinalizeSolutionStep() - - for process in self.list_of_processes: - process.ExecuteFinalizeSolutionStep() - - for process in self.list_of_processes: - process.ExecuteBeforeOutputStep() - - for process in self.list_of_processes: - process.ExecuteAfterOutputStep() - - if (self.output_post == True): - self.gid_output_structure.PrintOutput() - self.gid_output_fluid.PrintOutput() - - if (self.output_post == True): - self.gid_output_structure.ExecuteFinalize() - self.gid_output_fluid.ExecuteFinalize() - - for process in self.list_of_processes: - process.ExecuteFinalize() diff --git a/applications/FSIapplication/tests/KratosExecuteMapperTwoFacesTest.py b/applications/FSIapplication/tests/KratosExecuteMapperTwoFacesTest.py deleted file mode 100644 index 01130838a3e4..000000000000 --- a/applications/FSIapplication/tests/KratosExecuteMapperTwoFacesTest.py +++ /dev/null @@ -1,164 +0,0 @@ -from __future__ import print_function, absolute_import, division # makes KratosMultiphysics backward compatible with python 2.6 and 2.7 - -from KratosMultiphysics import * -from KratosMultiphysics.FSIApplication import * -try: - from KratosMultiphysics.ALEApplication import * - from KratosMultiphysics.FluidDynamicsApplication import * - from KratosMultiphysics.StructuralMechanicsApplication import * -except ImportError: - pass - -import os -import process_factory -import NonConformant_OneSideMap - -class KratosExecuteTwoFacesMapperTest: - - def __init__(self, ProjectParameters): - - # Json format solvers settings - ProjectParametersFluid = ProjectParameters["fluid_solver_settings"] - ProjectParametersSolid = ProjectParameters["structure_solver_settings"] - - # Defining a model part for the fluid and one for the structure - self.structure_main_model_part = ModelPart("structure_part") - self.fluid_main_model_part = ModelPart("fluid_part") - - # Set the domain size (2D or 3D test) - self.structure_main_model_part.ProcessInfo.SetValue(DOMAIN_SIZE, ProjectParametersFluid["problem_data"]["domain_size"].GetInt()) - self.fluid_main_model_part.ProcessInfo.SetValue(DOMAIN_SIZE, ProjectParametersSolid["problem_data"]["domain_size"].GetInt()) - - # Set the fluid and solid models - FluidModel = {ProjectParametersFluid["problem_data"]["model_part_name"].GetString() : self.structure_main_model_part} - SolidModel = {ProjectParametersSolid["problem_data"]["model_part_name"].GetString() : self.fluid_main_model_part} - - # Fluid model part variables addition - self.fluid_main_model_part.AddNodalSolutionStepVariable(VELOCITY) - self.fluid_main_model_part.AddNodalSolutionStepVariable(PRESSURE) - self.fluid_main_model_part.AddNodalSolutionStepVariable(REACTION) - - # Structure model part variables addition - self.structure_main_model_part.AddNodalSolutionStepVariable(VELOCITY) - self.structure_main_model_part.AddNodalSolutionStepVariable(PRESSURE) - self.structure_main_model_part.AddNodalSolutionStepVariable(POSITIVE_FACE_PRESSURE) - self.structure_main_model_part.AddNodalSolutionStepVariable(NEGATIVE_FACE_PRESSURE) - self.structure_main_model_part.AddNodalSolutionStepVariable(POINT_LOAD) - - # Mapper variables addition - NonConformant_OneSideMap.AddVariables(self.fluid_main_model_part, self.structure_main_model_part) - - # Fluid domain model reading - ModelPartIO(ProjectParametersFluid["solver_settings"]["model_import_settings"]["input_filename"].GetString()).ReadModelPart(self.fluid_main_model_part) - prepare_model_part_settings_fluid = Parameters("{}") - prepare_model_part_settings_fluid.AddValue("volume_model_part_name",ProjectParametersFluid["solver_settings"]["volume_model_part_name"]) - prepare_model_part_settings_fluid.AddValue("skin_parts",ProjectParametersFluid["solver_settings"]["skin_parts"]) - import check_and_prepare_model_process_fluid - check_and_prepare_model_process_fluid.CheckAndPrepareModelProcess(self.fluid_main_model_part, prepare_model_part_settings_fluid).Execute() - - # Solid domain model reading - computing_model_part_name = "computing_domain" - ModelPartIO(ProjectParametersSolid["solver_settings"]["model_import_settings"]["input_filename"].GetString()).ReadModelPart(self.structure_main_model_part) - prepare_model_part_settings_structure = Parameters("{}") - prepare_model_part_settings_structure.AddEmptyValue("computing_model_part_name").SetString(computing_model_part_name) - prepare_model_part_settings_structure.AddValue("problem_domain_sub_model_part_list",ProjectParametersSolid["solver_settings"]["problem_domain_sub_model_part_list"]) - prepare_model_part_settings_structure.AddValue("processes_sub_model_part_list",ProjectParametersSolid["solver_settings"]["processes_sub_model_part_list"]) - import check_and_prepare_model_process_structural - check_and_prepare_model_process_structural.CheckAndPrepareModelProcess(self.structure_main_model_part, prepare_model_part_settings_structure).Execute() - - # Get the list of the skin submodel parts where the fluid interface submodel part is stored - for i in range(ProjectParametersFluid["solver_settings"]["skin_parts"].size()): - skin_part_name = ProjectParametersFluid["solver_settings"]["skin_parts"][i].GetString() - FluidModel.update({skin_part_name: self.fluid_main_model_part.GetSubModelPart(skin_part_name)}) - - # Get the list of the submodel parts where the structure interface is stored - for i in range(ProjectParametersSolid["solver_settings"]["processes_sub_model_part_list"].size()): - part_name = ProjectParametersSolid["solver_settings"]["processes_sub_model_part_list"][i].GetString() - SolidModel.update({part_name: self.structure_main_model_part.GetSubModelPart(part_name)}) - - # Construct processes - self.list_of_processes = process_factory.KratosProcessFactory(FluidModel).ConstructListOfProcesses( ProjectParametersFluid["boundary_conditions_process_list"] ) - self.list_of_processes += process_factory.KratosProcessFactory(SolidModel).ConstructListOfProcesses( ProjectParametersSolid["constraints_process_list"] ) - - for process in self.list_of_processes: - process.ExecuteInitialize() - - # Mapper construction - search_radius_factor = 2.0 - mapper_max_iterations = 200 - mapper_tolerance = 1e-12 - self.mapper = NonConformant_OneSideMap.NonConformantTwoFaces_OneSideMap(self.fluid_main_model_part.GetSubModelPart("Fluid_interface_pos"), - self.fluid_main_model_part.GetSubModelPart("Fluid_interface_neg"), - self.structure_main_model_part.GetSubModelPart("Structure_interface"), - search_radius_factor, - mapper_max_iterations, - mapper_tolerance) - - # Output settings - self.output_post = False # Set this variable to True if it is need to print the results for debugging purposes - self.problem_path = os.getcwd() - - if (self.output_post == True): - from gid_output_process import GiDOutputProcess - - self.gid_output_structure = GiDOutputProcess(self.structure_main_model_part, - ProjectParametersSolid["problem_data"]["problem_name"].GetString()+"_structure", - ProjectParametersSolid["output_configuration"]) - - self.gid_output_fluid = GiDOutputProcess(self.fluid_main_model_part, - ProjectParametersFluid["problem_data"]["problem_name"].GetString()+"_fluid", - ProjectParametersFluid["output_configuration"]) - - self.gid_output_structure.ExecuteInitialize() - self.gid_output_fluid.ExecuteInitialize() - - def Solve(self): - - for process in self.list_of_processes: - process.ExecuteBeforeSolutionLoop() - - if (self.output_post == True): - self.gid_output_structure.ExecuteBeforeSolutionLoop() - self.gid_output_fluid.ExecuteBeforeSolutionLoop() - - self.structure_main_model_part.ProcessInfo[TIME_STEPS] = 1 - self.structure_main_model_part.CloneTimeStep(1.0) - self.fluid_main_model_part.ProcessInfo[TIME_STEPS] = 1 - self.fluid_main_model_part.CloneTimeStep(1.0) - - for process in self.list_of_processes: - process.ExecuteInitializeSolutionStep() - - if (self.output_post == True): - self.gid_output_structure.ExecuteInitializeSolutionStep() - self.gid_output_fluid.ExecuteInitializeSolutionStep() - - # Solve: Information transfer - self.mapper.PositiveFluidToStructure_ScalarMap(PRESSURE, POSITIVE_FACE_PRESSURE, True) - self.mapper.NegativeFluidToStructure_ScalarMap(PRESSURE, NEGATIVE_FACE_PRESSURE, True) - self.mapper.StructureToPositiveFluid_VectorMap(VELOCITY, VELOCITY, True, False) - self.mapper.StructureToNegativeFluid_VectorMap(VELOCITY, VELOCITY, True, False) - - if (self.output_post == True): - self.gid_output_structure.ExecuteFinalizeSolutionStep() - self.gid_output_fluid.ExecuteFinalizeSolutionStep() - - for process in self.list_of_processes: - process.ExecuteFinalizeSolutionStep() - - for process in self.list_of_processes: - process.ExecuteBeforeOutputStep() - - for process in self.list_of_processes: - process.ExecuteAfterOutputStep() - - if (self.output_post == True): - self.gid_output_structure.PrintOutput() - self.gid_output_fluid.PrintOutput() - - if (self.output_post == True): - self.gid_output_structure.ExecuteFinalize() - self.gid_output_fluid.ExecuteFinalize() - - for process in self.list_of_processes: - process.ExecuteFinalize() diff --git a/applications/FSIapplication/tests/KratosExecuteMokBenchmark.py b/applications/FSIapplication/tests/KratosExecuteMokBenchmark.py deleted file mode 100644 index 9e5c7baf043e..000000000000 --- a/applications/FSIapplication/tests/KratosExecuteMokBenchmark.py +++ /dev/null @@ -1,167 +0,0 @@ -from __future__ import print_function, absolute_import, division #makes KratosMultiphysics backward compatible with python 2.6 and 2.7 - -from KratosMultiphysics import * -from KratosMultiphysics.FSIApplication import * -try: - from KratosMultiphysics.ALEApplication import * - from KratosMultiphysics.FluidDynamicsApplication import * - from KratosMultiphysics.StructuralMechanicsApplication import * -except ImportError: - pass - -import process_factory -import KratosMultiphysics.KratosUnittest as KratosUnittest - -class KratosExecuteMokBenchmark(KratosUnittest.TestCase): - - def __init__(self, ProjectParameters): - - self.ProjectParameters = ProjectParameters - - ## Fluid-Structure model parts definition - self.structure_main_model_part = ModelPart(self.ProjectParameters["structure_solver_settings"]["problem_data"]["model_part_name"].GetString()) - self.structure_main_model_part.ProcessInfo.SetValue(DOMAIN_SIZE, self.ProjectParameters["structure_solver_settings"]["problem_data"]["domain_size"].GetInt()) - - self.fluid_main_model_part = ModelPart(self.ProjectParameters["fluid_solver_settings"]["problem_data"]["model_part_name"].GetString()) - self.fluid_main_model_part.ProcessInfo.SetValue(DOMAIN_SIZE, self.ProjectParameters["fluid_solver_settings"]["problem_data"]["domain_size"].GetInt()) - - FluidModel = {self.ProjectParameters["fluid_solver_settings"]["problem_data"]["model_part_name"].GetString() : self.fluid_main_model_part} - SolidModel = {self.ProjectParameters["structure_solver_settings"]["problem_data"]["model_part_name"].GetString() : self.structure_main_model_part} - - ## Solver construction - solver_module = __import__(ProjectParameters["coupling_solver_settings"]["solver_settings"]["solver_type"].GetString()) - self.solver = solver_module.CreateSolver(self.structure_main_model_part, self.fluid_main_model_part, self.ProjectParameters) - - self.solver.AddVariables() - - ## Read the model - note that SetBufferSize is done here - self.solver.ImportModelPart() - - ## Add AddDofs - self.solver.AddDofs() - - ## Initialize GiD I/O - self.output_post = False # Set this variable to True if it is need to print the results for debugging purposes - if (self.output_post == True): - from gid_output_process import GiDOutputProcess - - self.gid_output_structure = GiDOutputProcess(self.solver.structure_solver.GetComputingModelPart(), - self.ProjectParameters["structure_solver_settings"]["problem_data"]["problem_name"].GetString()+"_structure", - self.ProjectParameters["structure_solver_settings"]["output_configuration"]) - - self.gid_output_fluid = GiDOutputProcess(self.solver.fluid_solver.GetComputingModelPart(), - self.ProjectParameters["fluid_solver_settings"]["problem_data"]["problem_name"].GetString()+"_fluid", - self.ProjectParameters["fluid_solver_settings"]["output_configuration"]) - - self.gid_output_structure.ExecuteInitialize() - self.gid_output_fluid.ExecuteInitialize() - - ## Get the list of the skin submodel parts in the object Model (FLUID) - for i in range(self.ProjectParameters["fluid_solver_settings"]["solver_settings"]["skin_parts"].size()): - skin_part_name = self.ProjectParameters["fluid_solver_settings"]["solver_settings"]["skin_parts"][i].GetString() - FluidModel.update({skin_part_name: self.fluid_main_model_part.GetSubModelPart(skin_part_name)}) - - ## Get the list of the no-skin submodel parts in the object Model (FLUID) - for i in range(self.ProjectParameters["fluid_solver_settings"]["solver_settings"]["no_skin_parts"].size()): - no_skin_part_name = self.ProjectParameters["fluid_solver_settings"]["solver_settings"]["no_skin_parts"][i].GetString() - FluidModel.update({no_skin_part_name: self.fluid_main_model_part.GetSubModelPart(no_skin_part_name)}) - - ## Get the list of the initial conditions submodel parts in the object Model (FLUID) - for i in range(self.ProjectParameters["fluid_solver_settings"]["initial_conditions_process_list"].size()): - initial_cond_part_name = self.ProjectParameters["fluid_solver_settings"]["initial_conditions_process_list"][i]["Parameters"]["model_part_name"].GetString() - FluidModel.update({initial_cond_part_name: self.fluid_main_model_part.GetSubModelPart(initial_cond_part_name)}) - - ## Get the gravity submodel part in the object Model (FLUID) - for i in range(self.ProjectParameters["fluid_solver_settings"]["gravity"].size()): - gravity_part_name = self.ProjectParameters["fluid_solver_settings"]["gravity"][i]["Parameters"]["model_part_name"].GetString() - FluidModel.update({gravity_part_name: self.fluid_main_model_part.GetSubModelPart(gravity_part_name)}) - - ## Get the list of the submodel part in the object Model (STRUCTURE) - for i in range(self.ProjectParameters["structure_solver_settings"]["solver_settings"]["processes_sub_model_part_list"].size()): - part_name = self.ProjectParameters["structure_solver_settings"]["solver_settings"]["processes_sub_model_part_list"][i].GetString() - SolidModel.update({part_name: self.structure_main_model_part.GetSubModelPart(part_name)}) - - ## Processes construction - import process_factory - # "list_of_processes" contains all the processes already constructed (boundary conditions, initial conditions and gravity) - # Note that the conditions are firstly constructed. Otherwise, they may overwrite the BCs information. - - # FLUID DOMAIN PROCESSES - self.list_of_processes = process_factory.KratosProcessFactory(FluidModel).ConstructListOfProcesses( self.ProjectParameters["fluid_solver_settings"]["initial_conditions_process_list"] ) - self.list_of_processes += process_factory.KratosProcessFactory(FluidModel).ConstructListOfProcesses( self.ProjectParameters["fluid_solver_settings"]["boundary_conditions_process_list"] ) - self.list_of_processes += process_factory.KratosProcessFactory(FluidModel).ConstructListOfProcesses( self.ProjectParameters["fluid_solver_settings"]["gravity"] ) - - # SOLID DOMAIN PROCESSES - self.list_of_processes += process_factory.KratosProcessFactory(SolidModel).ConstructListOfProcesses( self.ProjectParameters["structure_solver_settings"]["constraints_process_list"] ) - self.list_of_processes += process_factory.KratosProcessFactory(SolidModel).ConstructListOfProcesses( self.ProjectParameters["structure_solver_settings"]["loads_process_list"] ) - - ## Processes initialization - for process in self.list_of_processes: - process.ExecuteInitialize() - - # Solver initialization moved after the processes initialization, otherwise the flag INTERFACE is not set - self.solver.Initialize() - - def Solve(self): - - ## Time settings - end_time = self.ProjectParameters["fluid_solver_settings"]["problem_data"]["end_time"].GetDouble() - time = 0.0 - step = 0 - out = 0.0 - - if (self.output_post == True): - self.gid_output_structure.ExecuteBeforeSolutionLoop() - self.gid_output_fluid.ExecuteBeforeSolutionLoop() - - for process in self.list_of_processes: - process.ExecuteBeforeSolutionLoop() - - while(time <= end_time): - - Dt = (self.solver).ComputeDeltaTime() - time = time + Dt - step = step + 1 - - self.solver.SetTimeStep(step) - - self.structure_main_model_part.CloneTimeStep(time) - self.fluid_main_model_part.CloneTimeStep(time) - - for process in self.list_of_processes: - process.ExecuteInitializeSolutionStep() - - if (self.output_post == True): - self.gid_output_structure.ExecuteInitializeSolutionStep() - self.gid_output_fluid.ExecuteInitializeSolutionStep() - - (self.solver).Solve() - - for process in self.list_of_processes: - process.ExecuteFinalizeSolutionStep() - - if (self.output_post == True): - self.gid_output_structure.ExecuteFinalizeSolutionStep() - self.gid_output_fluid.ExecuteFinalizeSolutionStep() - - #TODO: decide if it shall be done only when output is processed or not - for process in self.list_of_processes: - process.ExecuteBeforeOutputStep() - - if (self.output_post == True): - if self.gid_output_structure.IsOutputStep(): - self.gid_output_structure.PrintOutput() - if self.gid_output_fluid.IsOutputStep(): - self.gid_output_fluid.PrintOutput() - - for process in self.list_of_processes: - process.ExecuteAfterOutputStep() - - out = out + Dt - - for process in self.list_of_processes: - process.ExecuteFinalize() - - if (self.output_post == True): - self.gid_output_structure.ExecuteFinalize() - self.gid_output_fluid.ExecuteFinalize() diff --git a/applications/FSIapplication/tests/MokBenchmark/ProjectParameters.json b/applications/FSIapplication/tests/MokBenchmarkTest/ProjectParameters.json similarity index 95% rename from applications/FSIapplication/tests/MokBenchmark/ProjectParameters.json rename to applications/FSIapplication/tests/MokBenchmarkTest/ProjectParameters.json index 28f4e97d489a..5f54d8c74490 100644 --- a/applications/FSIapplication/tests/MokBenchmark/ProjectParameters.json +++ b/applications/FSIapplication/tests/MokBenchmarkTest/ProjectParameters.json @@ -3,6 +3,7 @@ "problem_data" : { "problem_name" : "mok_benchmark", "model_part_name" : "Structure", + "parallel_type" : "OpenMP", "domain_size" : 2, "time_step" : 0.1, "start_time" : 0.0, @@ -10,17 +11,16 @@ "echo_level" : 0 }, "solver_settings" : { - "solver_type" : "structural_mechanics_implicit_dynamic_solver", + "solver_type" : "Implicit", "echo_level" : 0, "solution_type" : "Dynamic", - "time_integration_method" : "Implicit", - "scheme_type" : "Newmark", + "scheme_type" : "Bossak", "model_import_settings" : { "input_type" : "mdpa", - "input_filename" : "MokBenchmark/mok_benchmark_Structural" + "input_filename" : "mok_benchmark_Structural" }, "material_import_settings" :{ - "materials_filename": "MokBenchmark/materials_Mok.json" + "materials_filename": "materials_Mok.json" }, "line_search" : false, "convergence_criterion" : "Residual_criterion", @@ -83,7 +83,7 @@ "skin_output" : false, "plane_output" : [], "nodal_results" : ["DISPLACEMENT","REACTION","VELOCITY","ACCELERATION"], - "gauss_point_results" : ["GREEN_LAGRANGE_STRAIN_TENSOR","CAUCHY_STRESS_TENSOR","VON_MISES_STRESS"] + "gauss_point_results" : [] }, "point_data_configuration" : [] }, @@ -137,7 +137,7 @@ "solver_type" : "Monolithic", "model_import_settings" : { "input_type" : "mdpa", - "input_filename" : "MokBenchmark/mok_benchmark_Fluid" + "input_filename" : "mok_benchmark_Fluid" }, "maximum_iterations" : 10, "dynamic_tau" : 0.001, @@ -252,7 +252,7 @@ "process_name" : "FromJsonCheckResultProcess", "Parameters" : { "check_variables" : ["MESH_DISPLACEMENT_X"], - "input_file_name" : "MokBenchmark/mok_benchmark_results.json", + "input_file_name" : "mok_benchmark_results.json", "model_part_name" : "Control_Nodes", "tolerance" : 1e-3, "time_frequency" : 0.1 @@ -284,7 +284,6 @@ "w_0" : 0.825 }, "mesh_solver" : "mesh_solver_structural_similarity", - "mesh_reform_dofs_each_step" : false, "structure_interfaces_list" : ["Interface2D_Structure_interface"], "fluid_interfaces_list" : ["FluidNoSlipInterface2D_Interface"] }, diff --git a/applications/FSIapplication/tests/MokBenchmark/materials_Mok.json b/applications/FSIapplication/tests/MokBenchmarkTest/materials_Mok.json similarity index 100% rename from applications/FSIapplication/tests/MokBenchmark/materials_Mok.json rename to applications/FSIapplication/tests/MokBenchmarkTest/materials_Mok.json diff --git a/applications/FSIapplication/tests/MokBenchmark/mok_benchmark_Fluid.mdpa b/applications/FSIapplication/tests/MokBenchmarkTest/mok_benchmark_Fluid.mdpa similarity index 100% rename from applications/FSIapplication/tests/MokBenchmark/mok_benchmark_Fluid.mdpa rename to applications/FSIapplication/tests/MokBenchmarkTest/mok_benchmark_Fluid.mdpa diff --git a/applications/FSIapplication/tests/MokBenchmark/mok_benchmark_Structural.mdpa b/applications/FSIapplication/tests/MokBenchmarkTest/mok_benchmark_Structural.mdpa similarity index 100% rename from applications/FSIapplication/tests/MokBenchmark/mok_benchmark_Structural.mdpa rename to applications/FSIapplication/tests/MokBenchmarkTest/mok_benchmark_Structural.mdpa diff --git a/applications/FSIapplication/tests/MokBenchmark/mok_benchmark_results.json b/applications/FSIapplication/tests/MokBenchmarkTest/mok_benchmark_results.json similarity index 100% rename from applications/FSIapplication/tests/MokBenchmark/mok_benchmark_results.json rename to applications/FSIapplication/tests/MokBenchmarkTest/mok_benchmark_results.json diff --git a/applications/FSIapplication/tests/NonConformantOneSideMap2D_test1/NonConformantOneSideMap2D_test1_parameters.json b/applications/FSIapplication/tests/NonConformantOneSideMap2D_test1/NonConformantOneSideMap2D_test1_parameters.json deleted file mode 100644 index 6ec7b1f26731..000000000000 --- a/applications/FSIapplication/tests/NonConformantOneSideMap2D_test1/NonConformantOneSideMap2D_test1_parameters.json +++ /dev/null @@ -1,93 +0,0 @@ -{ - "structure_solver_settings" : { - "problem_data" : { - "problem_name" : "NonConformantOneSideMap2D_test1", - "model_part_name" : "Structure", - "domain_size" : 2 - }, - "solver_settings" : { - "model_import_settings" : { - "input_type" : "mdpa", - "input_filename" : "NonConformantOneSideMap2D_test1/solid_mesh" - }, - "problem_domain_sub_model_part_list" : ["Parts_Solid"], - "processes_sub_model_part_list" : ["Structure_interface"] - }, - "constraints_process_list" : [{ - "python_module" : "NonConformantOneSideMap2D_test1_structure_local_process", - "kratos_module" : "KratosMultiphysics.FSIApplication", - "help" : [], - "process_name" : "ApplyLocalProcess", - "Parameters" : { - "mesh_id" : 0, - "model_part_name" : "Structure_interface" - } - }], - "output_configuration" : { - "result_file_configuration" : { - "gidpost_flags" : { - "GiDPostMode" : "GiD_PostBinary", - "WriteDeformedMeshFlag" : "WriteDeformed", - "WriteConditionsFlag" : "WriteConditions", - "MultiFileFlag" : "SingleFile" - }, - "file_label" : "step", - "output_control_type" : "step", - "output_frequency" : 1.0, - "body_output" : true, - "node_output" : false, - "skin_output" : false, - "plane_output" : [], - "nodal_results" : ["VELOCITY","PRESSURE","POINT_LOAD","VAUX_EQ_TRACTION","NODAL_MAUX"], - "gauss_point_results" : [] - }, - "point_data_configuration" : [] - } - }, - "fluid_solver_settings" : { - "problem_data" : { - "problem_name" : "NonConformantOneSideMap2D_test1", - "model_part_name" : "MainModelPart", - "domain_size" : 2 - }, - "output_configuration" : { - "result_file_configuration" : { - "gidpost_flags" : { - "GiDPostMode" : "GiD_PostBinary", - "WriteDeformedMeshFlag" : "WriteDeformed", - "WriteConditionsFlag" : "WriteConditions", - "MultiFileFlag" : "SingleFile" - }, - "file_label" : "step", - "output_control_type" : "step", - "output_frequency" : 1.0, - "body_output" : true, - "node_output" : false, - "skin_output" : false, - "plane_output" : [], - "nodal_results" : ["VELOCITY","PRESSURE","REACTION","VAUX_EQ_TRACTION","NODAL_MAUX"], - "gauss_point_results" : [] - }, - "point_data_configuration" : [] - }, - "solver_settings" : { - "model_import_settings" : { - "input_type" : "mdpa", - "input_filename" : "NonConformantOneSideMap2D_test1/fluid_mesh" - }, - "volume_model_part_name" : "Parts_Fluid", - "skin_parts" : ["Fluid_interface"], - "no_skin_parts" : [] - }, - "boundary_conditions_process_list" : [{ - "python_module" : "NonConformantOneSideMap2D_test1_fluid_local_process", - "kratos_module" : "KratosMultiphysics.FSIApplication", - "help" : [], - "process_name" : "ApplyLocalProcess", - "Parameters" : { - "mesh_id" : 0, - "model_part_name" : "Fluid_interface" - } - }] - } -} diff --git a/applications/FSIapplication/tests/NonConformantOneSideMap2D_test1_fluid_local_process.py b/applications/FSIapplication/tests/NonConformantOneSideMap2D_test1_fluid_local_process.py deleted file mode 100644 index 1fa6147cb781..000000000000 --- a/applications/FSIapplication/tests/NonConformantOneSideMap2D_test1_fluid_local_process.py +++ /dev/null @@ -1,74 +0,0 @@ -from __future__ import print_function, absolute_import, division #makes KratosMultiphysics backward compatible with python 2.6 and 2.7 - -# Importing the Kratos Library -from KratosMultiphysics import * -from KratosMultiphysics.StructuralMechanicsApplication import * -from KratosMultiphysics.FluidDynamicsApplication import * -from KratosMultiphysics.FSIApplication import * - -CheckForPreviousImport() - -# Import KratosUnittest -import KratosMultiphysics.KratosUnittest as KratosUnittest - -def Factory(settings, Model): - if(type(settings) != Parameters): - raise Exception("Expected input shall be a Parameters object, encapsulating a json string") - return ApplyLocalProcess(Model, settings["Parameters"]) - -class ApplyLocalProcess(Process, KratosUnittest.TestCase): - - def __init__(self,model_part,params): - - self.interface_model_part = model_part[params["model_part_name"].GetString()] - self.params = params - - - def ExecuteInitialize(self): - - # Constant pressure distribution - for node in self.interface_model_part.Nodes: - node.SetSolutionStepValue(PRESSURE, 0, 2.0) - - # Linear x-reaction distribution - self.interface_model_part.Nodes[1].SetSolutionStepValue(REACTION_X, 0, 2.0) - self.interface_model_part.Nodes[3].SetSolutionStepValue(REACTION_X, 0, 4.7) - self.interface_model_part.Nodes[5].SetSolutionStepValue(REACTION_X, 0, 5.6) - self.interface_model_part.Nodes[7].SetSolutionStepValue(REACTION_X, 0, 6.6) - self.interface_model_part.Nodes[9].SetSolutionStepValue(REACTION_X, 0, 3.6) - - # Linear y-reaction distribution - self.interface_model_part.Nodes[1].SetSolutionStepValue(REACTION_Y, 0, 3.6) - self.interface_model_part.Nodes[3].SetSolutionStepValue(REACTION_Y, 0, 6.6) - self.interface_model_part.Nodes[5].SetSolutionStepValue(REACTION_Y, 0, 5.6) - self.interface_model_part.Nodes[7].SetSolutionStepValue(REACTION_Y, 0, 4.7) - self.interface_model_part.Nodes[9].SetSolutionStepValue(REACTION_Y, 0, 2.0) - - - def ExecuteBeforeSolutionLoop(self): - pass - - - def ExecuteInitializeSolutionStep(self): - pass - - - def ExecuteFinalizeSolutionStep(self): - pass - - - def ExecuteBeforeOutputStep(self): - pass - - - def ExecuteAfterOutputStep(self): - pass - - - def ExecuteFinalize(self): - # Mapped VELOCITY check - for node in self.interface_model_part.Nodes: - obtained_velocity_value = node.GetSolutionStepValue(VELOCITY,0) - expected_velocity_value = [2*node.Y - node.Y*node.Y/2.0, 2*node.Y - node.Y*node.Y/2.0, 0.0] - for i in range(0,3): - self.assertAlmostEqual(obtained_velocity_value[i], expected_velocity_value[i], delta=0.1) diff --git a/applications/FSIapplication/tests/NonConformantOneSideMap2D_test1_structure_local_process.py b/applications/FSIapplication/tests/NonConformantOneSideMap2D_test1_structure_local_process.py deleted file mode 100644 index 4431e8316ab7..000000000000 --- a/applications/FSIapplication/tests/NonConformantOneSideMap2D_test1_structure_local_process.py +++ /dev/null @@ -1,79 +0,0 @@ -from __future__ import print_function, absolute_import, division #makes KratosMultiphysics backward compatible with python 2.6 and 2.7 - -# Importing the Kratos Library -from KratosMultiphysics import * -from KratosMultiphysics.StructuralMechanicsApplication import * -from KratosMultiphysics.FluidDynamicsApplication import * -from KratosMultiphysics.FSIApplication import * - -CheckForPreviousImport() - -# Import KratosUnittest -import KratosMultiphysics.KratosUnittest as KratosUnittest - -def Factory(settings, Model): - if(type(settings) != Parameters): - raise Exception("Expected input shall be a Parameters object, encapsulating a json string") - return ApplyLocalProcess(Model, settings["Parameters"]) - -class ApplyLocalProcess(Process, KratosUnittest.TestCase): - - def __init__(self,model_part,params): - - self.interface_model_part = model_part[params["model_part_name"].GetString()] - self.params = params - - - def ExecuteInitialize(self): - # Parabolic velocity distribution - for node in self.interface_model_part.Nodes: - node.SetSolutionStepValue(VELOCITY_X, 0, 2*node.Y - node.Y*node.Y/2.0) - node.SetSolutionStepValue(VELOCITY_Y, 0, 2*node.Y - node.Y*node.Y/2.0) - node.SetSolutionStepValue(VELOCITY_Z, 0, 0.0) - - - def ExecuteBeforeSolutionLoop(self): - pass - - - def ExecuteInitializeSolutionStep(self): - pass - - - def ExecuteFinalizeSolutionStep(self): - pass - - - def ExecuteBeforeOutputStep(self): - pass - - - def ExecuteAfterOutputStep(self): - pass - - - def ExecuteFinalize(self): - # Mapped PRESSURE check - for node in self.interface_model_part.Nodes: - obtained_pressure_value = node.GetSolutionStepValue(PRESSURE,0) - expected_pressure_value = 2.0 - self.assertAlmostEqual(obtained_pressure_value, expected_pressure_value) - - # Force equilibrium check (mapped POINT_LOAD) - expected_sum_fx = 22.5 - expected_sum_fy = 22.5 - expected_sum_fz = 0.0 - - obtained_sum_fx = 0.0 - obtained_sum_fy = 0.0 - obtained_sum_fz = 0.0 - - for node in self.interface_model_part.Nodes: - f_solid = node.GetSolutionStepValue(POINT_LOAD) - obtained_sum_fx += f_solid[0] - obtained_sum_fy += f_solid[1] - obtained_sum_fz += f_solid[2] - - self.assertAlmostEqual(obtained_sum_fx, expected_sum_fx, delta=0.1) - self.assertAlmostEqual(obtained_sum_fy, expected_sum_fy, delta=0.1) - self.assertAlmostEqual(obtained_sum_fz, expected_sum_fz, delta=0.1) diff --git a/applications/FSIapplication/tests/NonConformantOneSideMap2D_test2/NonConformantOneSideMap2D_test2_parameters.json b/applications/FSIapplication/tests/NonConformantOneSideMap2D_test2/NonConformantOneSideMap2D_test2_parameters.json deleted file mode 100644 index ed3de876d758..000000000000 --- a/applications/FSIapplication/tests/NonConformantOneSideMap2D_test2/NonConformantOneSideMap2D_test2_parameters.json +++ /dev/null @@ -1,93 +0,0 @@ -{ - "structure_solver_settings" : { - "problem_data" : { - "problem_name" : "NonConformantOneSideMap2D_test2", - "model_part_name" : "Structure", - "domain_size" : 2 - }, - "solver_settings" : { - "model_import_settings" : { - "input_type" : "mdpa", - "input_filename" : "NonConformantOneSideMap2D_test2/solid_mesh" - }, - "problem_domain_sub_model_part_list" : ["Parts_Solid"], - "processes_sub_model_part_list" : ["Structure_interface"] - }, - "constraints_process_list" : [{ - "python_module" : "NonConformantOneSideMap2D_test2_structure_local_process", - "kratos_module" : "KratosMultiphysics.FSIApplication", - "help" : [], - "process_name" : "ApplyLocalProcess", - "Parameters" : { - "mesh_id" : 0, - "model_part_name" : "Structure_interface" - } - }], - "output_configuration" : { - "result_file_configuration" : { - "gidpost_flags" : { - "GiDPostMode" : "GiD_PostBinary", - "WriteDeformedMeshFlag" : "WriteDeformed", - "WriteConditionsFlag" : "WriteConditions", - "MultiFileFlag" : "SingleFile" - }, - "file_label" : "step", - "output_control_type" : "step", - "output_frequency" : 1.0, - "body_output" : true, - "node_output" : false, - "skin_output" : false, - "plane_output" : [], - "nodal_results" : ["VELOCITY","PRESSURE","POINT_LOAD","VAUX_EQ_TRACTION","NODAL_MAUX"], - "gauss_point_results" : [] - }, - "point_data_configuration" : [] - } - }, - "fluid_solver_settings" : { - "problem_data" : { - "problem_name" : "NonConformantOneSideMap2D_test2", - "model_part_name" : "MainModelPart", - "domain_size" : 2 - }, - "output_configuration" : { - "result_file_configuration" : { - "gidpost_flags" : { - "GiDPostMode" : "GiD_PostBinary", - "WriteDeformedMeshFlag" : "WriteDeformed", - "WriteConditionsFlag" : "WriteConditions", - "MultiFileFlag" : "SingleFile" - }, - "file_label" : "step", - "output_control_type" : "step", - "output_frequency" : 1.0, - "body_output" : true, - "node_output" : false, - "skin_output" : false, - "plane_output" : [], - "nodal_results" : ["VELOCITY","PRESSURE","REACTION","VAUX_EQ_TRACTION","NODAL_MAUX"], - "gauss_point_results" : [] - }, - "point_data_configuration" : [] - }, - "solver_settings" : { - "model_import_settings" : { - "input_type" : "mdpa", - "input_filename" : "NonConformantOneSideMap2D_test2/fluid_mesh" - }, - "volume_model_part_name" : "Parts_Fluid", - "skin_parts" : ["Fluid_interface"], - "no_skin_parts" : [] - }, - "boundary_conditions_process_list" : [{ - "python_module" : "NonConformantOneSideMap2D_test2_fluid_local_process", - "kratos_module" : "KratosMultiphysics.FSIApplication", - "help" : [], - "process_name" : "ApplyLocalProcess", - "Parameters" : { - "mesh_id" : 0, - "model_part_name" : "Fluid_interface" - } - }] - } -} diff --git a/applications/FSIapplication/tests/NonConformantOneSideMap2D_test2_fluid_local_process.py b/applications/FSIapplication/tests/NonConformantOneSideMap2D_test2_fluid_local_process.py deleted file mode 100644 index e27d0786b5fe..000000000000 --- a/applications/FSIapplication/tests/NonConformantOneSideMap2D_test2_fluid_local_process.py +++ /dev/null @@ -1,62 +0,0 @@ -from __future__ import print_function, absolute_import, division #makes KratosMultiphysics backward compatible with python 2.6 and 2.7 - -# Importing the Kratos Library -from KratosMultiphysics import * -from KratosMultiphysics.StructuralMechanicsApplication import * -from KratosMultiphysics.FluidDynamicsApplication import * -from KratosMultiphysics.FSIApplication import * - -CheckForPreviousImport() - -# Import KratosUnittest -import KratosMultiphysics.KratosUnittest as KratosUnittest - -def Factory(settings, Model): - if(type(settings) != Parameters): - raise Exception("Expected input shall be a Parameters object, encapsulating a json string") - return ApplyLocalProcess(Model, settings["Parameters"]) - -class ApplyLocalProcess(Process, KratosUnittest.TestCase): - - def __init__(self,model_part,params): - - self.interface_model_part = model_part[params["model_part_name"].GetString()] - self.params = params - - - def ExecuteInitialize(self): - - # Constant pressure distribution - for node in self.interface_model_part.Nodes: - node.SetSolutionStepValue(PRESSURE, 0, node.Y*20) # Linear PRESSURE variation - node.SetSolutionStepValue(REACTION_X, 0, node.Y*30) # Linear REACTION_X variation - node.SetSolutionStepValue(REACTION_Y, 0, node.Y*node.Y*200) # Parabolic REACTION_Y variation - - - def ExecuteBeforeSolutionLoop(self): - pass - - - def ExecuteInitializeSolutionStep(self): - pass - - - def ExecuteFinalizeSolutionStep(self): - pass - - - def ExecuteBeforeOutputStep(self): - pass - - - def ExecuteAfterOutputStep(self): - pass - - - def ExecuteFinalize(self): - # Mapped VELOCITY check - for node in self.interface_model_part.Nodes: - obtained_velocity_value = node.GetSolutionStepValue(VELOCITY,0) - expected_velocity_value = [node.Y*10, node.Y*node.Y*10000, 0.0] - for i in range(0,3): - self.assertAlmostEqual(obtained_velocity_value[i], expected_velocity_value[i], delta=0.15) diff --git a/applications/FSIapplication/tests/NonConformantOneSideMap2D_test2_structure_local_process.py b/applications/FSIapplication/tests/NonConformantOneSideMap2D_test2_structure_local_process.py deleted file mode 100644 index 0a3e50438a2b..000000000000 --- a/applications/FSIapplication/tests/NonConformantOneSideMap2D_test2_structure_local_process.py +++ /dev/null @@ -1,79 +0,0 @@ -from __future__ import print_function, absolute_import, division #makes KratosMultiphysics backward compatible with python 2.6 and 2.7 - -# Importing the Kratos Library -from KratosMultiphysics import * -from KratosMultiphysics.StructuralMechanicsApplication import * -from KratosMultiphysics.FluidDynamicsApplication import * -from KratosMultiphysics.FSIApplication import * - -CheckForPreviousImport() - -# Import KratosUnittest -import KratosMultiphysics.KratosUnittest as KratosUnittest - -def Factory(settings, Model): - if(type(settings) != Parameters): - raise Exception("Expected input shall be a Parameters object, encapsulating a json string") - return ApplyLocalProcess(Model, settings["Parameters"]) - -class ApplyLocalProcess(Process, KratosUnittest.TestCase): - - def __init__(self,model_part,params): - - self.interface_model_part = model_part[params["model_part_name"].GetString()] - self.params = params - - - def ExecuteInitialize(self): - # Parabolic velocity distribution - for node in self.interface_model_part.Nodes: - node.SetSolutionStepValue(VELOCITY_X, 0, node.Y*10) # Linear VELOCITY_X distribution - node.SetSolutionStepValue(VELOCITY_Y, 0, node.Y*node.Y*10000) # Parabolic VELOCITY_Y distribution - node.SetSolutionStepValue(VELOCITY_Z, 0, 0.0) - - - def ExecuteBeforeSolutionLoop(self): - pass - - - def ExecuteInitializeSolutionStep(self): - pass - - - def ExecuteFinalizeSolutionStep(self): - pass - - - def ExecuteBeforeOutputStep(self): - pass - - - def ExecuteAfterOutputStep(self): - pass - - - def ExecuteFinalize(self): - # Mapped PRESSURE check - for node in self.interface_model_part.Nodes: - obtained_pressure_value = node.GetSolutionStepValue(PRESSURE,0) - expected_pressure_value = node.Y*20 - self.assertAlmostEqual(obtained_pressure_value, expected_pressure_value, delta=0.1) - - # Force equilibrium check (mapped POINT_LOAD) - expected_sum_fx = 765.0 - expected_sum_fy = 858.375 - expected_sum_fz = 0.0 - - obtained_sum_fx = 0.0 - obtained_sum_fy = 0.0 - obtained_sum_fz = 0.0 - - for node in self.interface_model_part.Nodes: - f_solid = node.GetSolutionStepValue(POINT_LOAD) - obtained_sum_fx += f_solid[0] - obtained_sum_fy += f_solid[1] - obtained_sum_fz += f_solid[2] - - self.assertAlmostEqual(obtained_sum_fx, expected_sum_fx, delta=0.1) - self.assertAlmostEqual(obtained_sum_fy, expected_sum_fy, delta=0.1) - self.assertAlmostEqual(obtained_sum_fz, expected_sum_fz, delta=0.1) diff --git a/applications/FSIapplication/tests/NonConformantOneSideMap3D_test1/NonConformantOneSideMap3D_test1_parameters.json b/applications/FSIapplication/tests/NonConformantOneSideMap3D_test1/NonConformantOneSideMap3D_test1_parameters.json deleted file mode 100644 index b4d7239003c2..000000000000 --- a/applications/FSIapplication/tests/NonConformantOneSideMap3D_test1/NonConformantOneSideMap3D_test1_parameters.json +++ /dev/null @@ -1,93 +0,0 @@ -{ - "structure_solver_settings" : { - "problem_data" : { - "problem_name" : "NonConformantOneSideMap3D_test1", - "model_part_name" : "Structure", - "domain_size" : 3 - }, - "solver_settings" : { - "model_import_settings" : { - "input_type" : "mdpa", - "input_filename" : "NonConformantOneSideMap3D_test1/solid_mesh" - }, - "problem_domain_sub_model_part_list" : ["Parts_Solid"], - "processes_sub_model_part_list" : ["Structure_interface"] - }, - "constraints_process_list" : [{ - "python_module" : "NonConformantOneSideMap3D_test1_structure_local_process", - "kratos_module" : "KratosMultiphysics.FSIApplication", - "help" : [], - "process_name" : "ApplyLocalProcess", - "Parameters" : { - "mesh_id" : 0, - "model_part_name" : "Structure_interface" - } - }], - "output_configuration" : { - "result_file_configuration" : { - "gidpost_flags" : { - "GiDPostMode" : "GiD_PostBinary", - "WriteDeformedMeshFlag" : "WriteDeformed", - "WriteConditionsFlag" : "WriteConditions", - "MultiFileFlag" : "SingleFile" - }, - "file_label" : "step", - "output_control_type" : "step", - "output_frequency" : 1.0, - "body_output" : true, - "node_output" : false, - "skin_output" : false, - "plane_output" : [], - "nodal_results" : ["VELOCITY","PRESSURE","POINT_LOAD","VAUX_EQ_TRACTION","NODAL_MAUX"], - "gauss_point_results" : [] - }, - "point_data_configuration" : [] - } - }, - "fluid_solver_settings" : { - "problem_data" : { - "problem_name" : "NonConformantOneSideMap3D_test1", - "model_part_name" : "MainModelPart", - "domain_size" : 3 - }, - "output_configuration" : { - "result_file_configuration" : { - "gidpost_flags" : { - "GiDPostMode" : "GiD_PostBinary", - "WriteDeformedMeshFlag" : "WriteDeformed", - "WriteConditionsFlag" : "WriteConditions", - "MultiFileFlag" : "SingleFile" - }, - "file_label" : "step", - "output_control_type" : "step", - "output_frequency" : 1.0, - "body_output" : true, - "node_output" : false, - "skin_output" : false, - "plane_output" : [], - "nodal_results" : ["VELOCITY","PRESSURE","REACTION","VAUX_EQ_TRACTION","NODAL_MAUX"], - "gauss_point_results" : [] - }, - "point_data_configuration" : [] - }, - "solver_settings" : { - "model_import_settings" : { - "input_type" : "mdpa", - "input_filename" : "NonConformantOneSideMap3D_test1/fluid_mesh" - }, - "volume_model_part_name" : "Parts_Fluid", - "skin_parts" : ["Fluid_interface"], - "no_skin_parts" : [] - }, - "boundary_conditions_process_list" : [{ - "python_module" : "NonConformantOneSideMap3D_test1_fluid_local_process", - "kratos_module" : "KratosMultiphysics.FSIApplication", - "help" : [], - "process_name" : "ApplyLocalProcess", - "Parameters" : { - "mesh_id" : 0, - "model_part_name" : "Fluid_interface" - } - }] - } -} diff --git a/applications/FSIapplication/tests/NonConformantOneSideMap3D_test1_fluid_local_process.py b/applications/FSIapplication/tests/NonConformantOneSideMap3D_test1_fluid_local_process.py deleted file mode 100644 index beeaef4fa126..000000000000 --- a/applications/FSIapplication/tests/NonConformantOneSideMap3D_test1_fluid_local_process.py +++ /dev/null @@ -1,65 +0,0 @@ -from __future__ import print_function, absolute_import, division #makes KratosMultiphysics backward compatible with python 2.6 and 2.7 - -# Importing the Kratos Library -from KratosMultiphysics import * -from KratosMultiphysics.StructuralMechanicsApplication import * -from KratosMultiphysics.FluidDynamicsApplication import * -from KratosMultiphysics.FSIApplication import * - -CheckForPreviousImport() - -# Import KratosUnittest -import KratosMultiphysics.KratosUnittest as KratosUnittest - -def Factory(settings, Model): - if(type(settings) != Parameters): - raise Exception("Expected input shall be a Parameters object, encapsulating a json string") - return ApplyLocalProcess(Model, settings["Parameters"]) - -class ApplyLocalProcess(Process, KratosUnittest.TestCase): - - def __init__(self,model_part,params): - - self.interface_model_part = model_part[params["model_part_name"].GetString()] - self.params = params - - - def ExecuteInitialize(self): - # Linear pressure distribution - for node in self.interface_model_part.Nodes: - node.SetSolutionStepValue(PRESSURE, 0, node.X*node.Y*node.Z) - - # Linear reaction distribution - for node in self.interface_model_part.Nodes: - node.SetSolutionStepValue(REACTION_X, 0, node.Y) - node.SetSolutionStepValue(REACTION_Y, 0, 2*node.Z) - node.SetSolutionStepValue(REACTION_Z, 0, 3*node.X) - - - def ExecuteBeforeSolutionLoop(self): - pass - - - def ExecuteInitializeSolutionStep(self): - pass - - - def ExecuteFinalizeSolutionStep(self): - pass - - - def ExecuteBeforeOutputStep(self): - pass - - - def ExecuteAfterOutputStep(self): - pass - - - def ExecuteFinalize(self): - # Mapped VELOCITY check - for node in self.interface_model_part.Nodes: - obtained_velocity_value = node.GetSolutionStepValue(VELOCITY,0) - expected_velocity_value = [-(2*node.Z-node.Y*node.Z/2.0) , 2*node.Z-node.Y*node.Z/2.0, node.X*node.Y] - for i in range(0,3): - self.assertAlmostEqual(obtained_velocity_value[i], expected_velocity_value[i], delta=5e-3) diff --git a/applications/FSIapplication/tests/NonConformantOneSideMap3D_test1_structure_local_process.py b/applications/FSIapplication/tests/NonConformantOneSideMap3D_test1_structure_local_process.py deleted file mode 100644 index 774f0e60ffdb..000000000000 --- a/applications/FSIapplication/tests/NonConformantOneSideMap3D_test1_structure_local_process.py +++ /dev/null @@ -1,79 +0,0 @@ -from __future__ import print_function, absolute_import, division #makes KratosMultiphysics backward compatible with python 2.6 and 2.7 - -# Importing the Kratos Library -from KratosMultiphysics import * -from KratosMultiphysics.StructuralMechanicsApplication import * -from KratosMultiphysics.FluidDynamicsApplication import * -from KratosMultiphysics.FSIApplication import * - -CheckForPreviousImport() - -# Import KratosUnittest -import KratosMultiphysics.KratosUnittest as KratosUnittest - -def Factory(settings, Model): - if(type(settings) != Parameters): - raise Exception("Expected input shall be a Parameters object, encapsulating a json string") - return ApplyLocalProcess(Model, settings["Parameters"]) - -class ApplyLocalProcess(Process, KratosUnittest.TestCase): - - def __init__(self,model_part,params): - - self.interface_model_part = model_part[params["model_part_name"].GetString()] - self.params = params - - - def ExecuteInitialize(self): - # Parabolic velocity distribution - for node in self.interface_model_part.Nodes: - node.SetSolutionStepValue(VELOCITY_X, 0, -(2*node.Z - node.Y*node.Z/2.0)) - node.SetSolutionStepValue(VELOCITY_Y, 0, 2*node.Z - node.Y*node.Z/2.0) - node.SetSolutionStepValue(VELOCITY_Z, 0, node.X*node.Y) - - - def ExecuteBeforeSolutionLoop(self): - pass - - - def ExecuteInitializeSolutionStep(self): - pass - - - def ExecuteFinalizeSolutionStep(self): - pass - - - def ExecuteBeforeOutputStep(self): - pass - - - def ExecuteAfterOutputStep(self): - pass - - - def ExecuteFinalize(self): - # Mapped PRESSURE check - for node in self.interface_model_part.Nodes: - obtained_pressure_value = node.GetSolutionStepValue(PRESSURE,0) - expected_pressure_value = node.X*node.Y*node.Z - self.assertAlmostEqual(obtained_pressure_value, expected_pressure_value, delta=5e-3) - - # Force equilibrium check (mapped POINT_LOAD) - expected_sum_fx = 69.54492675560007 - expected_sum_fy = 187.00000000000003 - expected_sum_fz = 352.3652168853 - - obtained_sum_fx = 0.0 - obtained_sum_fy = 0.0 - obtained_sum_fz = 0.0 - - for node in self.interface_model_part.Nodes: - f_solid = node.GetSolutionStepValue(POINT_LOAD) - obtained_sum_fx += f_solid[0] - obtained_sum_fy += f_solid[1] - obtained_sum_fz += f_solid[2] - - self.assertAlmostEqual(obtained_sum_fx, expected_sum_fx, delta=2.5) - self.assertAlmostEqual(obtained_sum_fy, expected_sum_fy, delta=5.0) - self.assertAlmostEqual(obtained_sum_fz, expected_sum_fz, delta=10.0) diff --git a/applications/FSIapplication/tests/NonConformantOneSideMap2D_test1/fluid_mesh.mdpa b/applications/FSIapplication/tests/NonConformantOneSideMapTest/2D_fluid_mesh_test1.mdpa similarity index 100% rename from applications/FSIapplication/tests/NonConformantOneSideMap2D_test1/fluid_mesh.mdpa rename to applications/FSIapplication/tests/NonConformantOneSideMapTest/2D_fluid_mesh_test1.mdpa diff --git a/applications/FSIapplication/tests/NonConformantOneSideMap2D_test2/fluid_mesh.mdpa b/applications/FSIapplication/tests/NonConformantOneSideMapTest/2D_fluid_mesh_test2.mdpa similarity index 100% rename from applications/FSIapplication/tests/NonConformantOneSideMap2D_test2/fluid_mesh.mdpa rename to applications/FSIapplication/tests/NonConformantOneSideMapTest/2D_fluid_mesh_test2.mdpa diff --git a/applications/FSIapplication/tests/NonConformantOneSideMap2D_test1/solid_mesh.mdpa b/applications/FSIapplication/tests/NonConformantOneSideMapTest/2D_solid_mesh_test1.mdpa similarity index 79% rename from applications/FSIapplication/tests/NonConformantOneSideMap2D_test1/solid_mesh.mdpa rename to applications/FSIapplication/tests/NonConformantOneSideMapTest/2D_solid_mesh_test1.mdpa index d22c35cb1cc9..6902b11584e1 100644 --- a/applications/FSIapplication/tests/NonConformantOneSideMap2D_test1/solid_mesh.mdpa +++ b/applications/FSIapplication/tests/NonConformantOneSideMapTest/2D_solid_mesh_test1.mdpa @@ -5,9 +5,9 @@ End ModelPartData Begin Properties 0 End Properties Begin Properties 1 - DENSITY 7.85000E+03 - YOUNG_MODULUS 2.06900E+11 - POISSON_RATIO 2.90000E-01 + DENSITY 7.85000E+03 + YOUNG_MODULUS 2.06900E+11 + POISSON_RATIO 2.90000E-01 End Properties Begin Nodes @@ -23,12 +23,12 @@ End Nodes Begin Elements SmallDisplacementElement2D4N// GUI group identifier: Structure - 1 1 1 2 4 3 - 2 1 3 4 6 5 + 1 1 1 2 4 3 + 2 1 3 4 6 5 3 1 5 6 8 7 End Elements -Begin Conditions Condition2D2N// GUI group identifier: Structure_interface +Begin Conditions Condition2D2N// GUI group identifier: Solid_interface 1 0 2 4 2 0 4 6 3 0 6 8 @@ -53,7 +53,7 @@ Begin SubModelPart Parts_Solid // Group Structure // Subtree Parts Begin SubModelPartConditions End SubModelPartConditions End SubModelPart -Begin SubModelPart Structure_interface // Group Structure_interface // Subtree Interface2D +Begin SubModelPart Solid_interface // Group Solid_interface // Subtree Interface2D Begin SubModelPartNodes 2 4 diff --git a/applications/FSIapplication/tests/NonConformantOneSideMap2D_test2/solid_mesh.mdpa b/applications/FSIapplication/tests/NonConformantOneSideMapTest/2D_solid_mesh_test2.mdpa similarity index 96% rename from applications/FSIapplication/tests/NonConformantOneSideMap2D_test2/solid_mesh.mdpa rename to applications/FSIapplication/tests/NonConformantOneSideMapTest/2D_solid_mesh_test2.mdpa index 75555c7d4da8..a89b7fc83dca 100644 --- a/applications/FSIapplication/tests/NonConformantOneSideMap2D_test2/solid_mesh.mdpa +++ b/applications/FSIapplication/tests/NonConformantOneSideMapTest/2D_solid_mesh_test2.mdpa @@ -5,9 +5,9 @@ End ModelPartData Begin Properties 0 End Properties Begin Properties 1 - DENSITY 7.85000E+03 - YOUNG_MODULUS 2.06900E+11 - POISSON_RATIO 2.90000E-01 + DENSITY 7.85000E+03 + YOUNG_MODULUS 2.06900E+11 + POISSON_RATIO 2.90000E-01 End Properties Begin Nodes @@ -92,47 +92,47 @@ Begin Nodes End Nodes Begin Elements SmallDisplacementElement2D4N// GUI group identifier: Structure - 1 1 4 3 1 2 - 2 1 6 5 3 4 - 3 1 8 7 5 6 - 4 1 10 9 7 8 - 5 1 12 11 9 10 - 6 1 14 13 11 12 - 7 1 16 15 13 14 - 8 1 18 17 15 16 - 9 1 20 19 17 18 - 10 1 22 21 19 20 - 11 1 24 23 21 22 - 12 1 26 25 23 24 - 13 1 28 27 25 26 - 14 1 30 29 27 28 - 15 1 32 31 29 30 - 16 1 34 33 31 32 - 17 1 36 35 33 34 - 18 1 38 37 35 36 - 19 1 40 39 37 38 - 20 1 42 41 39 40 - 21 1 44 43 41 42 - 22 1 46 45 43 44 - 23 1 48 47 45 46 - 24 1 50 49 47 48 - 25 1 52 51 49 50 - 26 1 54 53 51 52 - 27 1 56 55 53 54 - 28 1 58 57 55 56 - 29 1 60 59 57 58 - 30 1 62 61 59 60 - 31 1 64 63 61 62 - 32 1 66 65 63 64 - 33 1 68 67 65 66 - 34 1 70 69 67 68 - 35 1 72 71 69 70 - 36 1 74 73 71 72 - 37 1 76 75 73 74 - 38 1 78 77 75 76 + 1 1 4 3 1 2 + 2 1 6 5 3 4 + 3 1 8 7 5 6 + 4 1 10 9 7 8 + 5 1 12 11 9 10 + 6 1 14 13 11 12 + 7 1 16 15 13 14 + 8 1 18 17 15 16 + 9 1 20 19 17 18 + 10 1 22 21 19 20 + 11 1 24 23 21 22 + 12 1 26 25 23 24 + 13 1 28 27 25 26 + 14 1 30 29 27 28 + 15 1 32 31 29 30 + 16 1 34 33 31 32 + 17 1 36 35 33 34 + 18 1 38 37 35 36 + 19 1 40 39 37 38 + 20 1 42 41 39 40 + 21 1 44 43 41 42 + 22 1 46 45 43 44 + 23 1 48 47 45 46 + 24 1 50 49 47 48 + 25 1 52 51 49 50 + 26 1 54 53 51 52 + 27 1 56 55 53 54 + 28 1 58 57 55 56 + 29 1 60 59 57 58 + 30 1 62 61 59 60 + 31 1 64 63 61 62 + 32 1 66 65 63 64 + 33 1 68 67 65 66 + 34 1 70 69 67 68 + 35 1 72 71 69 70 + 36 1 74 73 71 72 + 37 1 76 75 73 74 + 38 1 78 77 75 76 End Elements -Begin Conditions Condition2D2N// GUI group identifier: Structure_interface +Begin Conditions Condition2D2N// GUI group identifier: Solid_interface 1 0 2 4 2 0 4 6 3 0 6 8 @@ -336,7 +336,7 @@ Begin SubModelPart Parts_Solid // Group Structure // Subtree Parts Begin SubModelPartConditions End SubModelPartConditions End SubModelPart -Begin SubModelPart Structure_interface // Group Structure_interface // Subtree Interface2D +Begin SubModelPart Solid_interface // Group Solid_interface // Subtree Interface2D Begin SubModelPartNodes 1 2 diff --git a/applications/FSIapplication/tests/NonConformantOneSideMap3D_test1/fluid_mesh.mdpa b/applications/FSIapplication/tests/NonConformantOneSideMapTest/3D_fluid_mesh_test1.mdpa similarity index 100% rename from applications/FSIapplication/tests/NonConformantOneSideMap3D_test1/fluid_mesh.mdpa rename to applications/FSIapplication/tests/NonConformantOneSideMapTest/3D_fluid_mesh_test1.mdpa diff --git a/applications/FSIapplication/tests/NonConformantOneSideMapTwoFaces3D_test1/fluid_mesh.mdpa b/applications/FSIapplication/tests/NonConformantOneSideMapTest/3D_fluid_mesh_two_faces_test.mdpa similarity index 100% rename from applications/FSIapplication/tests/NonConformantOneSideMapTwoFaces3D_test1/fluid_mesh.mdpa rename to applications/FSIapplication/tests/NonConformantOneSideMapTest/3D_fluid_mesh_two_faces_test.mdpa diff --git a/applications/FSIapplication/tests/NonConformantOneSideMap3D_test1/solid_mesh.mdpa b/applications/FSIapplication/tests/NonConformantOneSideMapTest/3D_solid_mesh_test1.mdpa similarity index 96% rename from applications/FSIapplication/tests/NonConformantOneSideMap3D_test1/solid_mesh.mdpa rename to applications/FSIapplication/tests/NonConformantOneSideMapTest/3D_solid_mesh_test1.mdpa index 5b111d4955db..a818bebfb048 100644 --- a/applications/FSIapplication/tests/NonConformantOneSideMap3D_test1/solid_mesh.mdpa +++ b/applications/FSIapplication/tests/NonConformantOneSideMapTest/3D_solid_mesh_test1.mdpa @@ -5,9 +5,9 @@ End ModelPartData Begin Properties 0 End Properties Begin Properties 1 - DENSITY 7.85000E+03 - YOUNG_MODULUS 2.06900E+11 - POISSON_RATIO 2.90000E-01 + DENSITY 7.85000E+03 + YOUNG_MODULUS 2.06900E+11 + POISSON_RATIO 2.90000E-01 End Properties Begin Nodes @@ -260,985 +260,985 @@ End Nodes Begin Elements Element3D4N// GUI group identifier: Structure - 1 1 91 49 88 63 - 2 1 46 81 74 59 - 3 1 213 166 187 137 - 4 1 186 181 211 180 - 5 1 144 77 150 83 - 6 1 155 137 122 165 - 7 1 145 97 129 131 - 8 1 105 104 84 62 - 9 1 31 24 47 49 - 10 1 130 123 121 80 - 11 1 220 227 232 215 - 12 1 32 55 34 48 - 13 1 45 53 77 65 - 14 1 109 161 153 120 - 15 1 220 227 215 210 - 16 1 129 145 100 97 - 17 1 68 79 99 71 - 18 1 217 193 236 202 - 19 1 135 136 86 107 - 20 1 224 193 221 202 - 21 1 130 148 85 80 - 22 1 179 153 188 159 - 23 1 84 104 86 62 - 24 1 101 131 154 125 - 25 1 194 170 169 145 - 26 1 177 112 168 156 - 27 1 17 14 40 23 - 28 1 113 99 79 95 - 29 1 158 111 149 159 - 30 1 234 209 241 231 - 31 1 88 154 162 128 - 32 1 111 153 109 159 - 33 1 155 136 122 102 - 34 1 187 166 134 137 - 35 1 157 144 170 100 - 36 1 3 4 2 1 - 37 1 168 152 151 106 - 38 1 113 149 158 111 - 39 1 34 55 32 23 - 40 1 174 145 179 159 - 41 1 59 36 38 64 - 42 1 229 220 232 203 - 43 1 140 135 186 156 - 44 1 139 149 93 111 - 45 1 167 105 142 148 - 46 1 206 222 211 181 - 47 1 58 64 86 62 - 48 1 114 166 175 137 - 49 1 205 228 196 166 - 50 1 149 110 93 111 - 51 1 186 104 152 135 - 52 1 34 29 32 48 - 53 1 206 197 222 181 - 54 1 26 24 31 37 - 55 1 114 82 122 146 - 56 1 44 24 23 18 - 57 1 85 104 105 62 - 58 1 45 41 20 27 - 59 1 203 233 229 216 - 60 1 112 106 72 91 - 61 1 245 243 244 242 - 62 1 240 223 221 224 - 63 1 108 100 170 145 - 64 1 39 59 74 87 - 65 1 236 237 240 243 - 66 1 244 243 238 242 - 67 1 177 106 112 156 - 68 1 41 77 45 53 - 69 1 17 43 34 40 - 70 1 211 186 192 181 - 71 1 138 115 141 166 - 72 1 38 62 26 50 - 73 1 152 96 151 106 - 74 1 211 192 206 181 - 75 1 132 158 171 153 - 76 1 61 97 109 101 - 77 1 138 141 185 166 - 78 1 38 64 36 37 - 79 1 20 28 39 53 - 80 1 178 150 164 117 - 81 1 3 14 6 8 - 82 1 164 87 114 117 - 83 1 129 117 178 146 - 84 1 5 13 4 12 - 85 1 213 155 221 165 - 86 1 143 91 156 107 - 87 1 143 156 112 107 - 88 1 31 47 57 49 - 89 1 126 144 94 77 - 90 1 26 58 42 50 - 91 1 230 216 224 209 - 92 1 109 111 108 61 - 93 1 81 141 138 115 - 94 1 3 8 6 9 - 95 1 138 114 74 115 - 96 1 178 175 204 146 - 97 1 155 137 134 102 - 98 1 171 188 200 153 - 99 1 111 153 95 120 - 100 1 196 114 164 166 - 101 1 86 49 91 89 - 102 1 54 73 79 69 - 103 1 193 189 198 160 - 104 1 148 152 186 104 - 105 1 37 89 64 63 - 106 1 169 129 194 145 - 107 1 214 212 230 191 - 108 1 181 209 211 180 - 109 1 10 23 19 18 - 110 1 185 201 226 228 - 111 1 153 161 154 120 - 112 1 237 209 241 224 - 113 1 28 24 22 36 - 114 1 189 173 161 131 - 115 1 12 9 15 24 - 116 1 106 104 86 107 - 117 1 4 5 3 2 - 118 1 205 185 226 228 - 119 1 168 112 177 106 - 120 1 86 104 58 62 - 121 1 169 100 144 117 - 122 1 28 18 24 36 - 123 1 186 136 140 180 - 124 1 187 155 213 137 - 125 1 20 8 22 28 - 126 1 35 15 21 26 - 127 1 22 28 9 24 - 128 1 240 237 236 224 - 129 1 157 108 94 100 - 130 1 75 41 39 53 - 131 1 5 6 7 10 - 132 1 16 10 7 17 - 133 1 99 88 68 71 - 134 1 182 154 195 191 - 135 1 221 209 224 202 - 136 1 141 201 166 187 - 137 1 15 26 12 24 - 138 1 68 99 98 88 - 139 1 167 141 105 134 - 140 1 193 175 218 165 - 141 1 132 88 99 120 - 142 1 84 115 81 90 - 143 1 134 166 115 137 - 144 1 132 162 127 88 - 145 1 114 115 138 166 - 146 1 198 204 217 193 - 147 1 108 111 109 159 - 148 1 158 153 111 159 - 149 1 32 47 31 44 - 150 1 157 183 108 170 - 151 1 113 153 132 120 - 152 1 115 166 114 137 - 153 1 98 88 127 128 - 154 1 46 28 22 38 - 155 1 221 223 165 193 - 156 1 234 231 211 209 - 157 1 224 209 216 202 - 158 1 95 101 109 120 - 159 1 7 6 5 2 - 160 1 7 10 6 17 - 161 1 53 83 77 65 - 162 1 116 150 164 147 - 163 1 117 82 114 146 - 164 1 168 143 190 156 - 165 1 198 129 178 146 - 166 1 136 89 128 125 - 167 1 30 44 23 18 - 168 1 236 224 233 202 - 169 1 178 129 169 117 - 170 1 95 69 61 56 - 171 1 186 155 187 135 - 172 1 194 129 198 189 - 173 1 46 59 39 28 - 174 1 97 82 76 52 - 175 1 42 31 57 26 - 176 1 9 28 14 18 - 177 1 59 38 46 64 - 178 1 137 90 102 92 - 179 1 238 242 243 224 - 180 1 32 29 34 23 - 181 1 3 6 5 9 - 182 1 178 117 114 146 - 183 1 175 166 213 137 - 184 1 25 62 38 50 - 185 1 100 77 144 83 - 186 1 85 105 60 62 - 187 1 71 40 95 56 - 188 1 200 179 220 203 - 189 1 146 165 193 160 - 190 1 119 70 123 67 - 191 1 158 188 171 153 - 192 1 67 70 123 80 - 193 1 6 10 5 9 - 194 1 109 56 61 101 - 195 1 38 36 24 37 - 196 1 57 96 78 58 - 197 1 67 35 70 50 - 198 1 216 209 230 191 - 199 1 237 243 236 224 - 200 1 78 152 130 80 - 201 1 96 57 72 106 - 202 1 44 49 56 63 - 203 1 124 75 150 77 - 204 1 186 181 140 156 - 205 1 68 55 79 71 - 206 1 19 23 32 44 - 207 1 114 87 74 90 - 208 1 111 95 109 120 - 209 1 198 189 129 160 - 210 1 71 56 88 63 - 211 1 129 160 189 131 - 212 1 106 156 186 135 - 213 1 30 24 44 18 - 214 1 24 36 30 49 - 215 1 157 94 126 144 - 216 1 79 69 95 71 - 217 1 108 145 174 159 - 218 1 213 175 155 165 - 219 1 238 243 244 224 - 220 1 28 38 59 36 - 221 1 154 200 161 153 - 222 1 142 105 85 148 - 223 1 55 73 54 48 - 224 1 221 237 240 224 - 225 1 205 138 185 166 - 226 1 46 84 81 64 - 227 1 240 235 221 223 - 228 1 177 152 168 106 - 229 1 14 27 20 11 - 230 1 136 102 86 89 - 231 1 239 238 233 242 - 232 1 95 40 69 56 - 233 1 86 107 136 89 - 234 1 112 72 98 91 - 235 1 200 154 161 203 - 236 1 164 150 116 87 - 237 1 162 88 132 154 - 238 1 178 204 198 146 - 239 1 203 239 233 219 - 240 1 97 52 61 65 - 241 1 122 82 129 146 - 242 1 79 55 54 69 - 243 1 105 81 60 84 - 244 1 20 8 14 11 - 245 1 113 111 158 153 - 246 1 98 91 88 128 - 247 1 55 69 44 40 - 248 1 203 189 233 216 - 249 1 200 203 212 191 - 250 1 150 117 144 83 - 251 1 71 49 44 63 - 252 1 233 216 189 202 - 253 1 191 173 182 125 - 254 1 143 98 127 128 - 255 1 162 132 171 154 - 256 1 14 28 30 18 - 257 1 130 80 152 104 - 258 1 162 195 197 182 - 259 1 200 153 179 161 - 260 1 39 22 46 28 - 261 1 129 97 76 131 - 262 1 95 56 109 101 - 263 1 64 63 89 92 - 264 1 58 78 106 96 - 265 1 85 60 51 62 - 266 1 85 123 142 148 - 267 1 57 58 26 37 - 268 1 116 164 176 147 - 269 1 74 87 59 90 - 270 1 233 219 217 189 - 271 1 22 24 26 38 - 272 1 20 41 45 53 - 273 1 155 165 136 180 - 274 1 88 101 71 120 - 275 1 243 242 236 224 - 276 1 124 144 126 77 - 277 1 31 26 21 24 - 278 1 236 193 224 202 - 279 1 148 104 186 135 - 280 1 194 179 199 145 - 281 1 140 91 143 128 - 282 1 174 183 199 145 - 283 1 39 28 59 53 - 284 1 14 45 20 27 - 285 1 78 58 106 80 - 286 1 149 111 139 159 - 287 1 19 10 16 17 - 288 1 26 38 24 37 - 289 1 209 202 182 191 - 290 1 237 224 221 209 - 291 1 124 66 75 77 - 292 1 59 53 28 52 - 293 1 140 136 128 180 - 294 1 221 231 237 209 - 295 1 12 13 26 15 - 296 1 5 12 4 9 - 297 1 21 31 42 26 - 298 1 168 112 143 156 - 299 1 129 82 117 146 - 300 1 44 40 71 56 - 301 1 162 154 182 128 - 302 1 130 123 85 148 - 303 1 75 77 41 53 - 304 1 59 87 39 53 - 305 1 176 138 205 166 - 306 1 229 233 239 238 - 307 1 44 69 55 71 - 308 1 101 63 76 103 - 309 1 135 156 140 107 - 310 1 192 190 206 156 - 311 1 118 66 124 77 - 312 1 189 202 216 173 - 313 1 16 29 19 23 - 314 1 43 30 14 61 - 315 1 206 172 197 181 - 316 1 188 184 208 159 - 317 1 215 227 199 179 - 318 1 43 61 14 65 - 319 1 95 153 113 120 - 320 1 201 141 166 185 - 321 1 43 45 94 65 - 322 1 116 75 74 87 - 323 1 143 140 172 156 - 324 1 126 66 118 77 - 325 1 200 210 220 179 - 326 1 192 181 186 156 - 327 1 152 80 78 106 - 328 1 61 56 30 52 - 329 1 55 68 47 44 - 330 1 14 8 20 28 - 331 1 235 213 221 223 - 332 1 209 234 241 230 - 333 1 147 75 116 87 - 334 1 127 88 162 128 - 335 1 218 213 235 223 - 336 1 82 83 53 52 - 337 1 9 24 28 18 - 338 1 124 126 118 77 - 339 1 109 100 108 145 - 340 1 182 209 163 202 - 341 1 236 242 233 224 - 342 1 78 121 80 130 - 343 1 218 228 235 213 - 344 1 195 214 197 182 - 345 1 24 38 22 36 - 346 1 81 84 141 115 - 347 1 106 58 86 104 - 348 1 238 224 230 216 - 349 1 34 23 17 40 - 350 1 210 215 220 179 - 351 1 91 89 49 63 - 352 1 93 110 113 111 - 353 1 108 183 174 145 - 354 1 94 144 157 100 - 355 1 220 179 215 203 - 356 1 152 104 106 135 - 357 1 179 203 200 161 - 358 1 60 38 25 62 - 359 1 30 61 43 40 - 360 1 150 75 147 87 - 361 1 78 42 57 58 - 362 1 99 132 127 88 - 363 1 189 203 233 219 - 364 1 31 19 32 44 - 365 1 143 91 98 128 - 366 1 43 61 108 69 - 367 1 42 58 78 50 - 368 1 128 89 88 125 - 369 1 76 82 59 52 - 370 1 172 181 140 128 - 371 1 124 147 150 75 - 372 1 33 15 35 26 - 373 1 108 100 109 61 - 374 1 59 28 46 38 - 375 1 109 145 108 159 - 376 1 55 23 34 40 - 377 1 188 153 158 159 - 378 1 76 101 56 63 - 379 1 51 60 25 62 - 380 1 170 144 169 100 - 381 1 80 104 85 62 - 382 1 163 202 193 160 - 383 1 221 213 186 155 - 384 1 154 173 191 125 - 385 1 21 26 15 24 - 386 1 13 33 25 26 - 387 1 130 152 148 104 - 388 1 12 5 15 9 - 389 1 24 49 31 37 - 390 1 239 229 232 203 - 391 1 163 165 122 160 - 392 1 163 202 209 180 - 393 1 176 164 116 138 - 394 1 218 175 196 166 - 395 1 4 8 3 9 - 396 1 122 146 129 160 - 397 1 186 177 192 156 - 398 1 223 224 236 193 - 399 1 109 61 95 69 - 400 1 209 241 224 230 - 401 1 41 66 45 77 - 402 1 196 228 218 166 - 403 1 197 181 172 128 - 404 1 196 175 178 146 - 405 1 95 61 109 56 - 406 1 140 181 172 156 - 407 1 199 174 207 183 - 408 1 44 56 71 63 - 409 1 162 182 197 128 - 410 1 217 189 193 202 - 411 1 105 84 60 62 - 412 1 112 91 143 107 - 413 1 129 97 100 83 - 414 1 121 78 80 70 - 415 1 39 20 22 28 - 416 1 210 227 215 179 - 417 1 232 219 239 203 - 418 1 57 26 31 37 - 419 1 208 174 210 159 - 420 1 74 59 81 90 - 421 1 150 147 116 87 - 422 1 194 169 198 129 - 423 1 49 89 37 63 - 424 1 51 62 25 50 - 425 1 209 237 241 231 - 426 1 183 170 199 145 - 427 1 190 177 168 156 - 428 1 193 202 189 160 - 429 1 169 144 150 117 - 430 1 14 17 40 43 - 431 1 144 100 94 77 - 432 1 210 179 188 159 - 433 1 114 137 175 146 - 434 1 172 140 143 128 - 435 1 26 38 58 62 - 436 1 172 127 162 128 - 437 1 233 238 229 216 - 438 1 215 232 203 219 - 439 1 200 220 212 203 - 440 1 200 188 210 179 - 441 1 22 8 12 9 - 442 1 175 146 137 165 - 443 1 60 84 46 38 - 444 1 169 129 100 117 - 445 1 218 204 196 175 - 446 1 163 128 182 125 - 447 1 46 22 25 38 - 448 1 46 38 84 64 - 449 1 189 216 203 173 - 450 1 197 209 181 180 - 451 1 197 181 182 180 - 452 1 136 165 163 180 - 453 1 109 61 100 97 - 454 1 201 141 167 187 - 455 1 36 56 30 49 - 456 1 148 80 130 104 - 457 1 81 138 74 115 - 458 1 45 66 41 27 - 459 1 203 161 189 173 - 460 1 223 221 165 213 - 461 1 174 179 210 159 - 462 1 55 44 23 40 - 463 1 105 141 81 84 - 464 1 38 64 58 62 - 465 1 35 26 42 50 - 466 1 47 32 55 44 - 467 1 236 223 240 224 - 468 1 143 172 190 156 - 469 1 130 85 123 80 - 470 1 153 154 171 120 - 471 1 93 108 139 111 - 472 1 167 187 141 134 - 473 1 203 216 212 191 - 474 1 94 61 43 65 - 475 1 244 241 238 224 - 476 1 156 91 140 107 - 477 1 185 228 205 166 - 478 1 15 13 5 12 - 479 1 213 187 186 155 - 480 1 221 186 211 180 - 481 1 217 219 198 189 - 482 1 14 8 3 11 - 483 1 74 138 116 114 - 484 1 198 219 194 189 - 485 1 221 224 223 193 - 486 1 19 31 21 24 - 487 1 178 114 196 146 - 488 1 80 58 106 104 - 489 1 22 26 25 38 - 490 1 176 205 196 166 - 491 1 94 108 43 61 - 492 1 113 132 99 95 - 493 1 19 21 10 24 - 494 1 25 60 46 38 - 495 1 116 114 164 87 - 496 1 212 220 229 203 - 497 1 157 170 108 100 - 498 1 224 216 233 202 - 499 1 237 241 244 224 - 500 1 122 136 155 165 - 501 1 57 106 96 58 - 502 1 239 203 233 229 - 503 1 212 229 230 216 - 504 1 187 134 155 137 - 505 1 182 128 163 180 - 506 1 221 202 193 180 - 507 1 12 26 22 24 - 508 1 30 56 44 49 - 509 1 106 156 135 107 - 510 1 193 146 175 165 - 511 1 113 110 149 111 - 512 1 34 29 17 23 - 513 1 129 122 76 82 - 514 1 46 74 39 59 - 515 1 14 23 17 18 - 516 1 199 179 174 145 - 517 1 80 62 51 50 - 518 1 123 70 121 80 - 519 1 175 137 155 165 - 520 1 22 9 12 24 - 521 1 109 145 179 161 - 522 1 214 195 212 191 - 523 1 100 83 97 65 - 524 1 136 125 163 103 - 525 1 19 44 31 24 - 526 1 158 184 188 159 - 527 1 19 17 16 23 - 528 1 218 223 204 193 - 529 1 131 125 101 103 - 530 1 193 165 163 160 - 531 1 99 95 132 120 - 532 1 69 40 61 56 - 533 1 87 82 117 83 - 534 1 42 26 57 58 - 535 1 85 148 105 104 - 536 1 211 231 221 209 - 537 1 222 197 211 181 - 538 1 20 45 14 28 - 539 1 115 137 114 90 - 540 1 155 175 213 137 - 541 1 21 42 35 26 - 542 1 187 135 155 134 - 543 1 108 174 139 159 - 544 1 98 99 127 88 - 545 1 127 172 143 128 - 546 1 15 9 21 24 - 547 1 113 95 111 153 - 548 1 74 75 39 87 - 549 1 139 111 108 159 - 550 1 59 82 76 92 - 551 1 100 129 169 145 - 552 1 111 61 109 69 - 553 1 100 145 109 97 - 554 1 199 170 194 145 - 555 1 111 95 113 69 - 556 1 170 100 169 145 - 557 1 6 17 10 9 - 558 1 15 5 10 9 - 559 1 99 71 95 120 - 560 1 61 40 30 56 - 561 1 96 72 112 106 - 562 1 8 9 22 28 - 563 1 217 223 236 193 - 564 1 208 184 174 159 - 565 1 23 44 19 24 - 566 1 85 80 148 104 - 567 1 17 29 16 23 - 568 1 218 193 204 175 - 569 1 19 29 32 23 - 570 1 14 23 30 40 - 571 1 71 101 95 120 - 572 1 198 193 217 189 - 573 1 19 24 10 18 - 574 1 172 162 197 128 - 575 1 14 9 8 28 - 576 1 75 66 41 77 - 577 1 122 137 114 146 - 578 1 164 196 178 114 - 579 1 188 179 200 153 - 580 1 215 199 194 179 - 581 1 86 91 58 107 - 582 1 204 175 193 146 - 583 1 211 209 221 180 - 584 1 218 175 213 165 - 585 1 13 12 26 25 - 586 1 94 100 108 61 - 587 1 26 50 33 25 - 588 1 199 227 210 179 - 589 1 137 146 122 165 - 590 1 112 156 106 107 - 591 1 123 85 67 80 - 592 1 76 97 129 82 - 593 1 59 82 87 53 - 594 1 179 145 109 159 - 595 1 133 96 152 78 - 596 1 152 130 133 78 - 597 1 196 175 114 166 - 598 1 212 216 230 191 - 599 1 108 61 111 69 - 600 1 133 96 151 152 - 601 1 97 101 76 131 - 602 1 109 95 111 69 - 603 1 60 81 46 84 - 604 1 209 202 221 180 - 605 1 198 169 178 129 - 606 1 182 181 197 128 - 607 1 57 49 58 37 - 608 1 67 51 33 50 - 609 1 182 202 173 191 - 610 1 39 87 75 53 - 611 1 119 70 121 123 - 612 1 61 97 76 52 - 613 1 23 24 19 18 - 614 1 54 43 93 69 - 615 1 158 149 184 159 - 616 1 154 120 101 125 - 617 1 88 89 91 63 - 618 1 186 187 148 135 - 619 1 22 12 25 26 - 620 1 75 53 87 83 - 621 1 12 8 4 9 - 622 1 80 106 152 104 - 623 1 150 87 164 117 - 624 1 17 9 14 18 - 625 1 85 51 67 80 - 626 1 232 215 203 220 - 627 1 55 69 79 71 - 628 1 109 153 179 159 - 629 1 13 15 33 26 - 630 1 91 107 86 89 - 631 1 32 23 55 44 - 632 1 113 95 79 69 - 633 1 121 78 133 130 - 634 1 68 44 55 71 - 635 1 31 44 47 24 - 636 1 76 56 36 63 - 637 1 132 113 158 153 - 638 1 74 114 116 87 - 639 1 204 223 217 193 - 640 1 238 241 230 224 - 641 1 188 208 210 159 - 642 1 212 203 229 216 - 643 1 233 242 238 224 - 644 1 233 224 238 216 - 645 1 58 104 80 62 - 646 1 45 66 126 77 - 647 1 108 170 183 145 - 648 1 114 175 196 146 - 649 1 93 73 54 69 - 650 1 163 209 182 180 - 651 1 200 154 203 191 - 652 1 64 38 58 37 - 653 1 196 204 178 175 - 654 1 10 24 9 18 - 655 1 210 225 207 208 - 656 1 21 9 10 24 - 657 1 210 225 227 207 - 658 1 10 17 19 23 - 659 1 216 202 209 191 - 660 1 51 70 67 80 - 661 1 210 174 199 179 - 662 1 199 210 207 174 - 663 1 210 227 199 207 - 664 1 61 69 43 40 - 665 1 210 207 174 208 - 666 1 152 106 186 135 - 667 1 79 95 99 71 - 668 1 150 144 124 77 - 669 1 14 30 43 40 - 670 1 53 52 83 65 - 671 1 156 106 186 177 - 672 1 190 192 177 156 - 673 1 54 34 55 48 - 674 1 93 111 113 69 - 675 1 244 243 237 224 - 676 1 151 112 168 106 - 677 1 55 73 79 54 - 678 1 182 128 154 125 - 679 1 94 45 126 77 - 680 1 114 117 87 82 - 681 1 104 135 148 134 - 682 1 6 8 14 9 - 683 1 202 182 173 163 - 684 1 23 44 30 40 - 685 1 186 152 177 106 - 686 1 229 238 230 216 - 687 1 6 14 17 9 - 688 1 10 21 15 9 - 689 1 3 5 4 9 - 690 1 96 152 78 106 - 691 1 22 38 28 36 - 692 1 151 96 112 106 - 693 1 206 181 192 156 - 694 1 190 172 206 156 - 695 1 172 181 206 156 - 696 1 72 106 57 91 - 697 1 106 58 57 91 - 698 1 112 98 143 91 - 699 1 174 184 139 159 - 700 1 155 134 135 102 - 701 1 44 24 30 49 - 702 1 181 128 182 180 - 703 1 88 56 71 101 - 704 1 30 40 44 56 - 705 1 221 155 186 180 - 706 1 193 165 221 180 - 707 1 128 136 163 180 - 708 1 182 209 197 180 - 709 1 140 156 143 91 - 710 1 47 24 44 49 - 711 1 197 182 214 209 - 712 1 200 212 195 191 - 713 1 211 181 197 209 - 714 1 211 222 234 209 - 715 1 234 222 214 209 - 716 1 211 197 222 209 - 717 1 222 197 214 209 - 718 1 171 153 200 154 - 719 1 233 217 236 202 - 720 1 233 189 217 202 - 721 1 129 82 97 83 - 722 1 88 120 154 125 - 723 1 58 91 106 107 - 724 1 104 135 86 107 - 725 1 154 131 173 125 - 726 1 171 195 162 154 - 727 1 195 182 162 154 - 728 1 77 53 75 83 - 729 1 86 64 58 37 - 730 1 75 87 150 83 - 731 1 140 136 135 107 - 732 1 106 135 104 107 - 733 1 117 82 129 83 - 734 1 150 77 75 83 - 735 1 184 149 139 159 - 736 1 108 93 43 69 - 737 1 108 111 93 69 - 738 1 79 73 110 69 - 739 1 110 73 93 69 - 740 1 79 110 113 69 - 741 1 110 93 113 69 - 742 1 114 82 87 90 - 743 1 141 115 84 134 - 744 1 234 230 209 214 - 745 1 141 84 105 134 - 746 1 148 135 187 134 - 747 1 34 43 54 40 - 748 1 43 69 54 40 - 749 1 179 153 109 161 - 750 1 95 71 69 40 - 751 1 69 71 44 40 - 752 1 54 55 34 40 - 753 1 54 69 55 40 - 754 1 84 104 105 134 - 755 1 105 104 148 134 - 756 1 105 148 167 134 - 757 1 148 187 167 134 - 758 1 115 134 141 166 - 759 1 141 134 187 166 - 760 1 45 28 20 53 - 761 1 39 41 20 53 - 762 1 164 114 178 117 - 763 1 228 187 213 166 - 764 1 82 53 59 52 - 765 1 178 169 150 117 - 766 1 228 213 218 166 - 767 1 213 175 218 166 - 768 1 176 196 164 166 - 769 1 164 138 176 166 - 770 1 116 138 164 166 - 771 1 116 114 138 166 - 772 1 164 114 116 166 - 773 1 201 228 185 166 - 774 1 201 187 228 166 - 775 1 30 23 14 18 - 776 1 76 56 61 52 - 777 1 36 56 76 52 - 778 1 84 102 115 90 - 779 1 58 91 86 37 - 780 1 6 3 5 2 - 781 1 31 49 57 37 - 782 1 10 9 17 18 - 783 1 17 23 10 18 - 784 1 24 18 30 36 - 785 1 30 18 28 36 - 786 1 179 145 194 161 - 787 1 86 58 106 107 - 788 1 155 136 186 180 - 789 1 30 52 28 65 - 790 1 163 165 193 180 - 791 1 51 80 85 62 - 792 1 84 38 60 62 - 793 1 221 165 155 180 - 794 1 104 134 84 102 - 795 1 122 137 155 102 - 796 1 71 56 95 101 - 797 1 214 182 195 191 - 798 1 122 165 146 160 - 799 1 78 58 80 50 - 800 1 78 80 70 50 - 801 1 76 103 89 92 - 802 1 193 202 163 180 - 803 1 70 35 42 50 - 804 1 26 62 58 50 - 805 1 58 62 80 50 - 806 1 145 161 109 131 - 807 1 140 181 186 180 - 808 1 140 128 181 180 - 809 1 84 64 38 62 - 810 1 86 64 84 62 - 811 1 100 61 94 65 - 812 1 86 102 64 89 - 813 1 88 128 91 89 - 814 1 76 97 61 56 - 815 1 132 95 113 120 - 816 1 132 154 88 120 - 817 1 215 179 194 161 - 818 1 215 203 179 161 - 819 1 219 189 203 161 - 820 1 194 189 219 161 - 821 1 194 219 215 161 - 822 1 219 203 215 161 - 823 1 100 117 129 83 - 824 1 87 117 150 83 - 825 1 144 117 100 83 - 826 1 87 53 82 83 - 827 1 186 135 140 136 - 828 1 155 135 186 136 - 829 1 161 120 109 131 - 830 1 42 78 70 50 - 831 1 70 80 51 50 - 832 1 67 70 51 50 - 833 1 25 38 26 50 - 834 1 33 35 67 50 - 835 1 14 28 45 65 - 836 1 202 191 216 173 - 837 1 45 77 94 65 - 838 1 122 103 76 92 - 839 1 106 91 112 107 - 840 1 163 136 122 165 - 841 1 97 56 76 101 - 842 1 213 223 218 165 - 843 1 223 193 218 165 - 844 1 89 125 136 103 - 845 1 61 56 97 101 - 846 1 154 191 182 125 - 847 1 109 153 111 120 - 848 1 154 128 88 125 - 849 1 129 146 198 160 - 850 1 132 153 171 120 - 851 1 64 90 59 92 - 852 1 163 136 128 125 - 853 1 137 102 122 92 - 854 1 171 154 132 120 - 855 1 204 193 198 160 - 856 1 204 146 193 160 - 857 1 198 146 204 160 - 858 1 76 82 122 92 - 859 1 154 161 203 173 - 860 1 109 97 145 131 - 861 1 202 160 163 173 - 862 1 61 52 30 65 - 863 1 122 136 163 103 - 864 1 88 63 101 103 - 865 1 84 134 115 102 - 866 1 57 91 58 49 - 867 1 86 104 84 102 - 868 1 134 137 115 102 - 869 1 57 47 72 49 - 870 1 72 91 57 49 - 871 1 47 44 68 49 - 872 1 44 71 68 49 - 873 1 68 71 88 49 - 874 1 47 68 72 49 - 875 1 88 91 98 49 - 876 1 98 91 72 49 - 877 1 84 64 86 102 - 878 1 102 89 136 92 - 879 1 68 98 72 49 - 880 1 68 88 98 49 - 881 1 94 77 100 65 - 882 1 182 173 163 125 - 883 1 28 53 45 65 - 884 1 203 191 154 173 - 885 1 189 160 202 173 - 886 1 101 120 88 125 - 887 1 88 71 99 120 - 888 1 195 171 200 191 - 889 1 195 154 171 191 - 890 1 171 154 200 191 - 891 1 28 52 53 65 - 892 1 160 173 189 131 - 893 1 109 101 97 131 - 894 1 161 173 154 131 - 895 1 214 209 182 191 - 896 1 230 209 214 191 - 897 1 58 38 26 37 - 898 1 36 49 24 37 - 899 1 30 36 28 52 - 900 1 30 56 36 52 - 901 1 28 36 59 52 - 902 1 59 36 76 52 - 903 1 64 102 84 90 - 904 1 74 115 114 90 - 905 1 87 82 59 90 - 906 1 50 26 33 35 - 907 1 81 115 74 90 - 908 1 115 102 137 90 - 909 1 58 49 91 37 - 910 1 91 49 86 37 - 911 1 216 191 203 173 - 912 1 109 120 101 131 - 913 1 86 136 135 102 - 914 1 135 136 155 102 - 915 1 25 50 33 51 - 916 1 36 37 64 63 - 917 1 86 135 104 102 - 918 1 135 134 104 102 - 919 1 88 49 71 63 - 920 1 122 102 136 92 - 921 1 56 101 88 63 - 922 1 56 49 36 63 - 923 1 49 37 36 63 - 924 1 100 97 61 65 - 925 1 91 128 140 89 - 926 1 128 136 140 89 - 927 1 136 107 140 89 - 928 1 140 107 91 89 - 929 1 86 37 49 89 - 930 1 64 37 86 89 - 931 1 101 125 88 103 - 932 1 122 89 136 103 - 933 1 88 125 89 103 - 934 1 76 131 101 103 - 935 1 77 83 100 65 - 936 1 14 45 43 65 - 937 1 64 89 102 92 - 938 1 101 120 154 131 - 939 1 154 120 161 131 - 940 1 194 145 129 131 - 941 1 129 189 194 131 - 942 1 189 161 194 131 - 943 1 194 161 145 131 - 944 1 102 90 64 92 - 945 1 89 63 76 92 - 946 1 163 173 160 125 - 947 1 173 131 160 125 - 948 1 136 89 122 92 - 949 1 89 103 122 92 - 950 1 30 28 14 65 - 951 1 14 61 30 65 - 952 1 97 83 82 65 - 953 1 83 52 82 65 - 954 1 82 52 97 65 - 955 1 81 64 84 90 - 956 1 81 59 46 90 - 957 1 59 64 46 90 - 958 1 46 64 81 90 - 959 1 76 63 89 103 - 960 1 89 63 88 103 - 961 1 163 160 122 103 - 962 1 163 125 160 103 - 963 1 76 122 129 103 - 964 1 129 131 76 103 - 965 1 160 125 131 103 - 966 1 122 160 129 103 - 967 1 160 131 129 103 - 968 1 59 90 82 92 - 969 1 122 82 114 92 - 970 1 82 90 114 92 - 971 1 114 137 122 92 - 972 1 114 90 137 92 - 973 1 36 63 64 92 - 974 1 76 63 36 92 - 975 1 76 36 59 92 - 976 1 36 64 59 92 + 1 1 91 49 88 63 + 2 1 46 81 74 59 + 3 1 213 166 187 137 + 4 1 186 181 211 180 + 5 1 144 77 150 83 + 6 1 155 137 122 165 + 7 1 145 97 129 131 + 8 1 105 104 84 62 + 9 1 31 24 47 49 + 10 1 130 123 121 80 + 11 1 220 227 232 215 + 12 1 32 55 34 48 + 13 1 45 53 77 65 + 14 1 109 161 153 120 + 15 1 220 227 215 210 + 16 1 129 145 100 97 + 17 1 68 79 99 71 + 18 1 217 193 236 202 + 19 1 135 136 86 107 + 20 1 224 193 221 202 + 21 1 130 148 85 80 + 22 1 179 153 188 159 + 23 1 84 104 86 62 + 24 1 101 131 154 125 + 25 1 194 170 169 145 + 26 1 177 112 168 156 + 27 1 17 14 40 23 + 28 1 113 99 79 95 + 29 1 158 111 149 159 + 30 1 234 209 241 231 + 31 1 88 154 162 128 + 32 1 111 153 109 159 + 33 1 155 136 122 102 + 34 1 187 166 134 137 + 35 1 157 144 170 100 + 36 1 3 4 2 1 + 37 1 168 152 151 106 + 38 1 113 149 158 111 + 39 1 34 55 32 23 + 40 1 174 145 179 159 + 41 1 59 36 38 64 + 42 1 229 220 232 203 + 43 1 140 135 186 156 + 44 1 139 149 93 111 + 45 1 167 105 142 148 + 46 1 206 222 211 181 + 47 1 58 64 86 62 + 48 1 114 166 175 137 + 49 1 205 228 196 166 + 50 1 149 110 93 111 + 51 1 186 104 152 135 + 52 1 34 29 32 48 + 53 1 206 197 222 181 + 54 1 26 24 31 37 + 55 1 114 82 122 146 + 56 1 44 24 23 18 + 57 1 85 104 105 62 + 58 1 45 41 20 27 + 59 1 203 233 229 216 + 60 1 112 106 72 91 + 61 1 245 243 244 242 + 62 1 240 223 221 224 + 63 1 108 100 170 145 + 64 1 39 59 74 87 + 65 1 236 237 240 243 + 66 1 244 243 238 242 + 67 1 177 106 112 156 + 68 1 41 77 45 53 + 69 1 17 43 34 40 + 70 1 211 186 192 181 + 71 1 138 115 141 166 + 72 1 38 62 26 50 + 73 1 152 96 151 106 + 74 1 211 192 206 181 + 75 1 132 158 171 153 + 76 1 61 97 109 101 + 77 1 138 141 185 166 + 78 1 38 64 36 37 + 79 1 20 28 39 53 + 80 1 178 150 164 117 + 81 1 3 14 6 8 + 82 1 164 87 114 117 + 83 1 129 117 178 146 + 84 1 5 13 4 12 + 85 1 213 155 221 165 + 86 1 143 91 156 107 + 87 1 143 156 112 107 + 88 1 31 47 57 49 + 89 1 126 144 94 77 + 90 1 26 58 42 50 + 91 1 230 216 224 209 + 92 1 109 111 108 61 + 93 1 81 141 138 115 + 94 1 3 8 6 9 + 95 1 138 114 74 115 + 96 1 178 175 204 146 + 97 1 155 137 134 102 + 98 1 171 188 200 153 + 99 1 111 153 95 120 + 100 1 196 114 164 166 + 101 1 86 49 91 89 + 102 1 54 73 79 69 + 103 1 193 189 198 160 + 104 1 148 152 186 104 + 105 1 37 89 64 63 + 106 1 169 129 194 145 + 107 1 214 212 230 191 + 108 1 181 209 211 180 + 109 1 10 23 19 18 + 110 1 185 201 226 228 + 111 1 153 161 154 120 + 112 1 237 209 241 224 + 113 1 28 24 22 36 + 114 1 189 173 161 131 + 115 1 12 9 15 24 + 116 1 106 104 86 107 + 117 1 4 5 3 2 + 118 1 205 185 226 228 + 119 1 168 112 177 106 + 120 1 86 104 58 62 + 121 1 169 100 144 117 + 122 1 28 18 24 36 + 123 1 186 136 140 180 + 124 1 187 155 213 137 + 125 1 20 8 22 28 + 126 1 35 15 21 26 + 127 1 22 28 9 24 + 128 1 240 237 236 224 + 129 1 157 108 94 100 + 130 1 75 41 39 53 + 131 1 5 6 7 10 + 132 1 16 10 7 17 + 133 1 99 88 68 71 + 134 1 182 154 195 191 + 135 1 221 209 224 202 + 136 1 141 201 166 187 + 137 1 15 26 12 24 + 138 1 68 99 98 88 + 139 1 167 141 105 134 + 140 1 193 175 218 165 + 141 1 132 88 99 120 + 142 1 84 115 81 90 + 143 1 134 166 115 137 + 144 1 132 162 127 88 + 145 1 114 115 138 166 + 146 1 198 204 217 193 + 147 1 108 111 109 159 + 148 1 158 153 111 159 + 149 1 32 47 31 44 + 150 1 157 183 108 170 + 151 1 113 153 132 120 + 152 1 115 166 114 137 + 153 1 98 88 127 128 + 154 1 46 28 22 38 + 155 1 221 223 165 193 + 156 1 234 231 211 209 + 157 1 224 209 216 202 + 158 1 95 101 109 120 + 159 1 7 6 5 2 + 160 1 7 10 6 17 + 161 1 53 83 77 65 + 162 1 116 150 164 147 + 163 1 117 82 114 146 + 164 1 168 143 190 156 + 165 1 198 129 178 146 + 166 1 136 89 128 125 + 167 1 30 44 23 18 + 168 1 236 224 233 202 + 169 1 178 129 169 117 + 170 1 95 69 61 56 + 171 1 186 155 187 135 + 172 1 194 129 198 189 + 173 1 46 59 39 28 + 174 1 97 82 76 52 + 175 1 42 31 57 26 + 176 1 9 28 14 18 + 177 1 59 38 46 64 + 178 1 137 90 102 92 + 179 1 238 242 243 224 + 180 1 32 29 34 23 + 181 1 3 6 5 9 + 182 1 178 117 114 146 + 183 1 175 166 213 137 + 184 1 25 62 38 50 + 185 1 100 77 144 83 + 186 1 85 105 60 62 + 187 1 71 40 95 56 + 188 1 200 179 220 203 + 189 1 146 165 193 160 + 190 1 119 70 123 67 + 191 1 158 188 171 153 + 192 1 67 70 123 80 + 193 1 6 10 5 9 + 194 1 109 56 61 101 + 195 1 38 36 24 37 + 196 1 57 96 78 58 + 197 1 67 35 70 50 + 198 1 216 209 230 191 + 199 1 237 243 236 224 + 200 1 78 152 130 80 + 201 1 96 57 72 106 + 202 1 44 49 56 63 + 203 1 124 75 150 77 + 204 1 186 181 140 156 + 205 1 68 55 79 71 + 206 1 19 23 32 44 + 207 1 114 87 74 90 + 208 1 111 95 109 120 + 209 1 198 189 129 160 + 210 1 71 56 88 63 + 211 1 129 160 189 131 + 212 1 106 156 186 135 + 213 1 30 24 44 18 + 214 1 24 36 30 49 + 215 1 157 94 126 144 + 216 1 79 69 95 71 + 217 1 108 145 174 159 + 218 1 213 175 155 165 + 219 1 238 243 244 224 + 220 1 28 38 59 36 + 221 1 154 200 161 153 + 222 1 142 105 85 148 + 223 1 55 73 54 48 + 224 1 221 237 240 224 + 225 1 205 138 185 166 + 226 1 46 84 81 64 + 227 1 240 235 221 223 + 228 1 177 152 168 106 + 229 1 14 27 20 11 + 230 1 136 102 86 89 + 231 1 239 238 233 242 + 232 1 95 40 69 56 + 233 1 86 107 136 89 + 234 1 112 72 98 91 + 235 1 200 154 161 203 + 236 1 164 150 116 87 + 237 1 162 88 132 154 + 238 1 178 204 198 146 + 239 1 203 239 233 219 + 240 1 97 52 61 65 + 241 1 122 82 129 146 + 242 1 79 55 54 69 + 243 1 105 81 60 84 + 244 1 20 8 14 11 + 245 1 113 111 158 153 + 246 1 98 91 88 128 + 247 1 55 69 44 40 + 248 1 203 189 233 216 + 249 1 200 203 212 191 + 250 1 150 117 144 83 + 251 1 71 49 44 63 + 252 1 233 216 189 202 + 253 1 191 173 182 125 + 254 1 143 98 127 128 + 255 1 162 132 171 154 + 256 1 14 28 30 18 + 257 1 130 80 152 104 + 258 1 162 195 197 182 + 259 1 200 153 179 161 + 260 1 39 22 46 28 + 261 1 129 97 76 131 + 262 1 95 56 109 101 + 263 1 64 63 89 92 + 264 1 58 78 106 96 + 265 1 85 60 51 62 + 266 1 85 123 142 148 + 267 1 57 58 26 37 + 268 1 116 164 176 147 + 269 1 74 87 59 90 + 270 1 233 219 217 189 + 271 1 22 24 26 38 + 272 1 20 41 45 53 + 273 1 155 165 136 180 + 274 1 88 101 71 120 + 275 1 243 242 236 224 + 276 1 124 144 126 77 + 277 1 31 26 21 24 + 278 1 236 193 224 202 + 279 1 148 104 186 135 + 280 1 194 179 199 145 + 281 1 140 91 143 128 + 282 1 174 183 199 145 + 283 1 39 28 59 53 + 284 1 14 45 20 27 + 285 1 78 58 106 80 + 286 1 149 111 139 159 + 287 1 19 10 16 17 + 288 1 26 38 24 37 + 289 1 209 202 182 191 + 290 1 237 224 221 209 + 291 1 124 66 75 77 + 292 1 59 53 28 52 + 293 1 140 136 128 180 + 294 1 221 231 237 209 + 295 1 12 13 26 15 + 296 1 5 12 4 9 + 297 1 21 31 42 26 + 298 1 168 112 143 156 + 299 1 129 82 117 146 + 300 1 44 40 71 56 + 301 1 162 154 182 128 + 302 1 130 123 85 148 + 303 1 75 77 41 53 + 304 1 59 87 39 53 + 305 1 176 138 205 166 + 306 1 229 233 239 238 + 307 1 44 69 55 71 + 308 1 101 63 76 103 + 309 1 135 156 140 107 + 310 1 192 190 206 156 + 311 1 118 66 124 77 + 312 1 189 202 216 173 + 313 1 16 29 19 23 + 314 1 43 30 14 61 + 315 1 206 172 197 181 + 316 1 188 184 208 159 + 317 1 215 227 199 179 + 318 1 43 61 14 65 + 319 1 95 153 113 120 + 320 1 201 141 166 185 + 321 1 43 45 94 65 + 322 1 116 75 74 87 + 323 1 143 140 172 156 + 324 1 126 66 118 77 + 325 1 200 210 220 179 + 326 1 192 181 186 156 + 327 1 152 80 78 106 + 328 1 61 56 30 52 + 329 1 55 68 47 44 + 330 1 14 8 20 28 + 331 1 235 213 221 223 + 332 1 209 234 241 230 + 333 1 147 75 116 87 + 334 1 127 88 162 128 + 335 1 218 213 235 223 + 336 1 82 83 53 52 + 337 1 9 24 28 18 + 338 1 124 126 118 77 + 339 1 109 100 108 145 + 340 1 182 209 163 202 + 341 1 236 242 233 224 + 342 1 78 121 80 130 + 343 1 218 228 235 213 + 344 1 195 214 197 182 + 345 1 24 38 22 36 + 346 1 81 84 141 115 + 347 1 106 58 86 104 + 348 1 238 224 230 216 + 349 1 34 23 17 40 + 350 1 210 215 220 179 + 351 1 91 89 49 63 + 352 1 93 110 113 111 + 353 1 108 183 174 145 + 354 1 94 144 157 100 + 355 1 220 179 215 203 + 356 1 152 104 106 135 + 357 1 179 203 200 161 + 358 1 60 38 25 62 + 359 1 30 61 43 40 + 360 1 150 75 147 87 + 361 1 78 42 57 58 + 362 1 99 132 127 88 + 363 1 189 203 233 219 + 364 1 31 19 32 44 + 365 1 143 91 98 128 + 366 1 43 61 108 69 + 367 1 42 58 78 50 + 368 1 128 89 88 125 + 369 1 76 82 59 52 + 370 1 172 181 140 128 + 371 1 124 147 150 75 + 372 1 33 15 35 26 + 373 1 108 100 109 61 + 374 1 59 28 46 38 + 375 1 109 145 108 159 + 376 1 55 23 34 40 + 377 1 188 153 158 159 + 378 1 76 101 56 63 + 379 1 51 60 25 62 + 380 1 170 144 169 100 + 381 1 80 104 85 62 + 382 1 163 202 193 160 + 383 1 221 213 186 155 + 384 1 154 173 191 125 + 385 1 21 26 15 24 + 386 1 13 33 25 26 + 387 1 130 152 148 104 + 388 1 12 5 15 9 + 389 1 24 49 31 37 + 390 1 239 229 232 203 + 391 1 163 165 122 160 + 392 1 163 202 209 180 + 393 1 176 164 116 138 + 394 1 218 175 196 166 + 395 1 4 8 3 9 + 396 1 122 146 129 160 + 397 1 186 177 192 156 + 398 1 223 224 236 193 + 399 1 109 61 95 69 + 400 1 209 241 224 230 + 401 1 41 66 45 77 + 402 1 196 228 218 166 + 403 1 197 181 172 128 + 404 1 196 175 178 146 + 405 1 95 61 109 56 + 406 1 140 181 172 156 + 407 1 199 174 207 183 + 408 1 44 56 71 63 + 409 1 162 182 197 128 + 410 1 217 189 193 202 + 411 1 105 84 60 62 + 412 1 112 91 143 107 + 413 1 129 97 100 83 + 414 1 121 78 80 70 + 415 1 39 20 22 28 + 416 1 210 227 215 179 + 417 1 232 219 239 203 + 418 1 57 26 31 37 + 419 1 208 174 210 159 + 420 1 74 59 81 90 + 421 1 150 147 116 87 + 422 1 194 169 198 129 + 423 1 49 89 37 63 + 424 1 51 62 25 50 + 425 1 209 237 241 231 + 426 1 183 170 199 145 + 427 1 190 177 168 156 + 428 1 193 202 189 160 + 429 1 169 144 150 117 + 430 1 14 17 40 43 + 431 1 144 100 94 77 + 432 1 210 179 188 159 + 433 1 114 137 175 146 + 434 1 172 140 143 128 + 435 1 26 38 58 62 + 436 1 172 127 162 128 + 437 1 233 238 229 216 + 438 1 215 232 203 219 + 439 1 200 220 212 203 + 440 1 200 188 210 179 + 441 1 22 8 12 9 + 442 1 175 146 137 165 + 443 1 60 84 46 38 + 444 1 169 129 100 117 + 445 1 218 204 196 175 + 446 1 163 128 182 125 + 447 1 46 22 25 38 + 448 1 46 38 84 64 + 449 1 189 216 203 173 + 450 1 197 209 181 180 + 451 1 197 181 182 180 + 452 1 136 165 163 180 + 453 1 109 61 100 97 + 454 1 201 141 167 187 + 455 1 36 56 30 49 + 456 1 148 80 130 104 + 457 1 81 138 74 115 + 458 1 45 66 41 27 + 459 1 203 161 189 173 + 460 1 223 221 165 213 + 461 1 174 179 210 159 + 462 1 55 44 23 40 + 463 1 105 141 81 84 + 464 1 38 64 58 62 + 465 1 35 26 42 50 + 466 1 47 32 55 44 + 467 1 236 223 240 224 + 468 1 143 172 190 156 + 469 1 130 85 123 80 + 470 1 153 154 171 120 + 471 1 93 108 139 111 + 472 1 167 187 141 134 + 473 1 203 216 212 191 + 474 1 94 61 43 65 + 475 1 244 241 238 224 + 476 1 156 91 140 107 + 477 1 185 228 205 166 + 478 1 15 13 5 12 + 479 1 213 187 186 155 + 480 1 221 186 211 180 + 481 1 217 219 198 189 + 482 1 14 8 3 11 + 483 1 74 138 116 114 + 484 1 198 219 194 189 + 485 1 221 224 223 193 + 486 1 19 31 21 24 + 487 1 178 114 196 146 + 488 1 80 58 106 104 + 489 1 22 26 25 38 + 490 1 176 205 196 166 + 491 1 94 108 43 61 + 492 1 113 132 99 95 + 493 1 19 21 10 24 + 494 1 25 60 46 38 + 495 1 116 114 164 87 + 496 1 212 220 229 203 + 497 1 157 170 108 100 + 498 1 224 216 233 202 + 499 1 237 241 244 224 + 500 1 122 136 155 165 + 501 1 57 106 96 58 + 502 1 239 203 233 229 + 503 1 212 229 230 216 + 504 1 187 134 155 137 + 505 1 182 128 163 180 + 506 1 221 202 193 180 + 507 1 12 26 22 24 + 508 1 30 56 44 49 + 509 1 106 156 135 107 + 510 1 193 146 175 165 + 511 1 113 110 149 111 + 512 1 34 29 17 23 + 513 1 129 122 76 82 + 514 1 46 74 39 59 + 515 1 14 23 17 18 + 516 1 199 179 174 145 + 517 1 80 62 51 50 + 518 1 123 70 121 80 + 519 1 175 137 155 165 + 520 1 22 9 12 24 + 521 1 109 145 179 161 + 522 1 214 195 212 191 + 523 1 100 83 97 65 + 524 1 136 125 163 103 + 525 1 19 44 31 24 + 526 1 158 184 188 159 + 527 1 19 17 16 23 + 528 1 218 223 204 193 + 529 1 131 125 101 103 + 530 1 193 165 163 160 + 531 1 99 95 132 120 + 532 1 69 40 61 56 + 533 1 87 82 117 83 + 534 1 42 26 57 58 + 535 1 85 148 105 104 + 536 1 211 231 221 209 + 537 1 222 197 211 181 + 538 1 20 45 14 28 + 539 1 115 137 114 90 + 540 1 155 175 213 137 + 541 1 21 42 35 26 + 542 1 187 135 155 134 + 543 1 108 174 139 159 + 544 1 98 99 127 88 + 545 1 127 172 143 128 + 546 1 15 9 21 24 + 547 1 113 95 111 153 + 548 1 74 75 39 87 + 549 1 139 111 108 159 + 550 1 59 82 76 92 + 551 1 100 129 169 145 + 552 1 111 61 109 69 + 553 1 100 145 109 97 + 554 1 199 170 194 145 + 555 1 111 95 113 69 + 556 1 170 100 169 145 + 557 1 6 17 10 9 + 558 1 15 5 10 9 + 559 1 99 71 95 120 + 560 1 61 40 30 56 + 561 1 96 72 112 106 + 562 1 8 9 22 28 + 563 1 217 223 236 193 + 564 1 208 184 174 159 + 565 1 23 44 19 24 + 566 1 85 80 148 104 + 567 1 17 29 16 23 + 568 1 218 193 204 175 + 569 1 19 29 32 23 + 570 1 14 23 30 40 + 571 1 71 101 95 120 + 572 1 198 193 217 189 + 573 1 19 24 10 18 + 574 1 172 162 197 128 + 575 1 14 9 8 28 + 576 1 75 66 41 77 + 577 1 122 137 114 146 + 578 1 164 196 178 114 + 579 1 188 179 200 153 + 580 1 215 199 194 179 + 581 1 86 91 58 107 + 582 1 204 175 193 146 + 583 1 211 209 221 180 + 584 1 218 175 213 165 + 585 1 13 12 26 25 + 586 1 94 100 108 61 + 587 1 26 50 33 25 + 588 1 199 227 210 179 + 589 1 137 146 122 165 + 590 1 112 156 106 107 + 591 1 123 85 67 80 + 592 1 76 97 129 82 + 593 1 59 82 87 53 + 594 1 179 145 109 159 + 595 1 133 96 152 78 + 596 1 152 130 133 78 + 597 1 196 175 114 166 + 598 1 212 216 230 191 + 599 1 108 61 111 69 + 600 1 133 96 151 152 + 601 1 97 101 76 131 + 602 1 109 95 111 69 + 603 1 60 81 46 84 + 604 1 209 202 221 180 + 605 1 198 169 178 129 + 606 1 182 181 197 128 + 607 1 57 49 58 37 + 608 1 67 51 33 50 + 609 1 182 202 173 191 + 610 1 39 87 75 53 + 611 1 119 70 121 123 + 612 1 61 97 76 52 + 613 1 23 24 19 18 + 614 1 54 43 93 69 + 615 1 158 149 184 159 + 616 1 154 120 101 125 + 617 1 88 89 91 63 + 618 1 186 187 148 135 + 619 1 22 12 25 26 + 620 1 75 53 87 83 + 621 1 12 8 4 9 + 622 1 80 106 152 104 + 623 1 150 87 164 117 + 624 1 17 9 14 18 + 625 1 85 51 67 80 + 626 1 232 215 203 220 + 627 1 55 69 79 71 + 628 1 109 153 179 159 + 629 1 13 15 33 26 + 630 1 91 107 86 89 + 631 1 32 23 55 44 + 632 1 113 95 79 69 + 633 1 121 78 133 130 + 634 1 68 44 55 71 + 635 1 31 44 47 24 + 636 1 76 56 36 63 + 637 1 132 113 158 153 + 638 1 74 114 116 87 + 639 1 204 223 217 193 + 640 1 238 241 230 224 + 641 1 188 208 210 159 + 642 1 212 203 229 216 + 643 1 233 242 238 224 + 644 1 233 224 238 216 + 645 1 58 104 80 62 + 646 1 45 66 126 77 + 647 1 108 170 183 145 + 648 1 114 175 196 146 + 649 1 93 73 54 69 + 650 1 163 209 182 180 + 651 1 200 154 203 191 + 652 1 64 38 58 37 + 653 1 196 204 178 175 + 654 1 10 24 9 18 + 655 1 210 225 207 208 + 656 1 21 9 10 24 + 657 1 210 225 227 207 + 658 1 10 17 19 23 + 659 1 216 202 209 191 + 660 1 51 70 67 80 + 661 1 210 174 199 179 + 662 1 199 210 207 174 + 663 1 210 227 199 207 + 664 1 61 69 43 40 + 665 1 210 207 174 208 + 666 1 152 106 186 135 + 667 1 79 95 99 71 + 668 1 150 144 124 77 + 669 1 14 30 43 40 + 670 1 53 52 83 65 + 671 1 156 106 186 177 + 672 1 190 192 177 156 + 673 1 54 34 55 48 + 674 1 93 111 113 69 + 675 1 244 243 237 224 + 676 1 151 112 168 106 + 677 1 55 73 79 54 + 678 1 182 128 154 125 + 679 1 94 45 126 77 + 680 1 114 117 87 82 + 681 1 104 135 148 134 + 682 1 6 8 14 9 + 683 1 202 182 173 163 + 684 1 23 44 30 40 + 685 1 186 152 177 106 + 686 1 229 238 230 216 + 687 1 6 14 17 9 + 688 1 10 21 15 9 + 689 1 3 5 4 9 + 690 1 96 152 78 106 + 691 1 22 38 28 36 + 692 1 151 96 112 106 + 693 1 206 181 192 156 + 694 1 190 172 206 156 + 695 1 172 181 206 156 + 696 1 72 106 57 91 + 697 1 106 58 57 91 + 698 1 112 98 143 91 + 699 1 174 184 139 159 + 700 1 155 134 135 102 + 701 1 44 24 30 49 + 702 1 181 128 182 180 + 703 1 88 56 71 101 + 704 1 30 40 44 56 + 705 1 221 155 186 180 + 706 1 193 165 221 180 + 707 1 128 136 163 180 + 708 1 182 209 197 180 + 709 1 140 156 143 91 + 710 1 47 24 44 49 + 711 1 197 182 214 209 + 712 1 200 212 195 191 + 713 1 211 181 197 209 + 714 1 211 222 234 209 + 715 1 234 222 214 209 + 716 1 211 197 222 209 + 717 1 222 197 214 209 + 718 1 171 153 200 154 + 719 1 233 217 236 202 + 720 1 233 189 217 202 + 721 1 129 82 97 83 + 722 1 88 120 154 125 + 723 1 58 91 106 107 + 724 1 104 135 86 107 + 725 1 154 131 173 125 + 726 1 171 195 162 154 + 727 1 195 182 162 154 + 728 1 77 53 75 83 + 729 1 86 64 58 37 + 730 1 75 87 150 83 + 731 1 140 136 135 107 + 732 1 106 135 104 107 + 733 1 117 82 129 83 + 734 1 150 77 75 83 + 735 1 184 149 139 159 + 736 1 108 93 43 69 + 737 1 108 111 93 69 + 738 1 79 73 110 69 + 739 1 110 73 93 69 + 740 1 79 110 113 69 + 741 1 110 93 113 69 + 742 1 114 82 87 90 + 743 1 141 115 84 134 + 744 1 234 230 209 214 + 745 1 141 84 105 134 + 746 1 148 135 187 134 + 747 1 34 43 54 40 + 748 1 43 69 54 40 + 749 1 179 153 109 161 + 750 1 95 71 69 40 + 751 1 69 71 44 40 + 752 1 54 55 34 40 + 753 1 54 69 55 40 + 754 1 84 104 105 134 + 755 1 105 104 148 134 + 756 1 105 148 167 134 + 757 1 148 187 167 134 + 758 1 115 134 141 166 + 759 1 141 134 187 166 + 760 1 45 28 20 53 + 761 1 39 41 20 53 + 762 1 164 114 178 117 + 763 1 228 187 213 166 + 764 1 82 53 59 52 + 765 1 178 169 150 117 + 766 1 228 213 218 166 + 767 1 213 175 218 166 + 768 1 176 196 164 166 + 769 1 164 138 176 166 + 770 1 116 138 164 166 + 771 1 116 114 138 166 + 772 1 164 114 116 166 + 773 1 201 228 185 166 + 774 1 201 187 228 166 + 775 1 30 23 14 18 + 776 1 76 56 61 52 + 777 1 36 56 76 52 + 778 1 84 102 115 90 + 779 1 58 91 86 37 + 780 1 6 3 5 2 + 781 1 31 49 57 37 + 782 1 10 9 17 18 + 783 1 17 23 10 18 + 784 1 24 18 30 36 + 785 1 30 18 28 36 + 786 1 179 145 194 161 + 787 1 86 58 106 107 + 788 1 155 136 186 180 + 789 1 30 52 28 65 + 790 1 163 165 193 180 + 791 1 51 80 85 62 + 792 1 84 38 60 62 + 793 1 221 165 155 180 + 794 1 104 134 84 102 + 795 1 122 137 155 102 + 796 1 71 56 95 101 + 797 1 214 182 195 191 + 798 1 122 165 146 160 + 799 1 78 58 80 50 + 800 1 78 80 70 50 + 801 1 76 103 89 92 + 802 1 193 202 163 180 + 803 1 70 35 42 50 + 804 1 26 62 58 50 + 805 1 58 62 80 50 + 806 1 145 161 109 131 + 807 1 140 181 186 180 + 808 1 140 128 181 180 + 809 1 84 64 38 62 + 810 1 86 64 84 62 + 811 1 100 61 94 65 + 812 1 86 102 64 89 + 813 1 88 128 91 89 + 814 1 76 97 61 56 + 815 1 132 95 113 120 + 816 1 132 154 88 120 + 817 1 215 179 194 161 + 818 1 215 203 179 161 + 819 1 219 189 203 161 + 820 1 194 189 219 161 + 821 1 194 219 215 161 + 822 1 219 203 215 161 + 823 1 100 117 129 83 + 824 1 87 117 150 83 + 825 1 144 117 100 83 + 826 1 87 53 82 83 + 827 1 186 135 140 136 + 828 1 155 135 186 136 + 829 1 161 120 109 131 + 830 1 42 78 70 50 + 831 1 70 80 51 50 + 832 1 67 70 51 50 + 833 1 25 38 26 50 + 834 1 33 35 67 50 + 835 1 14 28 45 65 + 836 1 202 191 216 173 + 837 1 45 77 94 65 + 838 1 122 103 76 92 + 839 1 106 91 112 107 + 840 1 163 136 122 165 + 841 1 97 56 76 101 + 842 1 213 223 218 165 + 843 1 223 193 218 165 + 844 1 89 125 136 103 + 845 1 61 56 97 101 + 846 1 154 191 182 125 + 847 1 109 153 111 120 + 848 1 154 128 88 125 + 849 1 129 146 198 160 + 850 1 132 153 171 120 + 851 1 64 90 59 92 + 852 1 163 136 128 125 + 853 1 137 102 122 92 + 854 1 171 154 132 120 + 855 1 204 193 198 160 + 856 1 204 146 193 160 + 857 1 198 146 204 160 + 858 1 76 82 122 92 + 859 1 154 161 203 173 + 860 1 109 97 145 131 + 861 1 202 160 163 173 + 862 1 61 52 30 65 + 863 1 122 136 163 103 + 864 1 88 63 101 103 + 865 1 84 134 115 102 + 866 1 57 91 58 49 + 867 1 86 104 84 102 + 868 1 134 137 115 102 + 869 1 57 47 72 49 + 870 1 72 91 57 49 + 871 1 47 44 68 49 + 872 1 44 71 68 49 + 873 1 68 71 88 49 + 874 1 47 68 72 49 + 875 1 88 91 98 49 + 876 1 98 91 72 49 + 877 1 84 64 86 102 + 878 1 102 89 136 92 + 879 1 68 98 72 49 + 880 1 68 88 98 49 + 881 1 94 77 100 65 + 882 1 182 173 163 125 + 883 1 28 53 45 65 + 884 1 203 191 154 173 + 885 1 189 160 202 173 + 886 1 101 120 88 125 + 887 1 88 71 99 120 + 888 1 195 171 200 191 + 889 1 195 154 171 191 + 890 1 171 154 200 191 + 891 1 28 52 53 65 + 892 1 160 173 189 131 + 893 1 109 101 97 131 + 894 1 161 173 154 131 + 895 1 214 209 182 191 + 896 1 230 209 214 191 + 897 1 58 38 26 37 + 898 1 36 49 24 37 + 899 1 30 36 28 52 + 900 1 30 56 36 52 + 901 1 28 36 59 52 + 902 1 59 36 76 52 + 903 1 64 102 84 90 + 904 1 74 115 114 90 + 905 1 87 82 59 90 + 906 1 50 26 33 35 + 907 1 81 115 74 90 + 908 1 115 102 137 90 + 909 1 58 49 91 37 + 910 1 91 49 86 37 + 911 1 216 191 203 173 + 912 1 109 120 101 131 + 913 1 86 136 135 102 + 914 1 135 136 155 102 + 915 1 25 50 33 51 + 916 1 36 37 64 63 + 917 1 86 135 104 102 + 918 1 135 134 104 102 + 919 1 88 49 71 63 + 920 1 122 102 136 92 + 921 1 56 101 88 63 + 922 1 56 49 36 63 + 923 1 49 37 36 63 + 924 1 100 97 61 65 + 925 1 91 128 140 89 + 926 1 128 136 140 89 + 927 1 136 107 140 89 + 928 1 140 107 91 89 + 929 1 86 37 49 89 + 930 1 64 37 86 89 + 931 1 101 125 88 103 + 932 1 122 89 136 103 + 933 1 88 125 89 103 + 934 1 76 131 101 103 + 935 1 77 83 100 65 + 936 1 14 45 43 65 + 937 1 64 89 102 92 + 938 1 101 120 154 131 + 939 1 154 120 161 131 + 940 1 194 145 129 131 + 941 1 129 189 194 131 + 942 1 189 161 194 131 + 943 1 194 161 145 131 + 944 1 102 90 64 92 + 945 1 89 63 76 92 + 946 1 163 173 160 125 + 947 1 173 131 160 125 + 948 1 136 89 122 92 + 949 1 89 103 122 92 + 950 1 30 28 14 65 + 951 1 14 61 30 65 + 952 1 97 83 82 65 + 953 1 83 52 82 65 + 954 1 82 52 97 65 + 955 1 81 64 84 90 + 956 1 81 59 46 90 + 957 1 59 64 46 90 + 958 1 46 64 81 90 + 959 1 76 63 89 103 + 960 1 89 63 88 103 + 961 1 163 160 122 103 + 962 1 163 125 160 103 + 963 1 76 122 129 103 + 964 1 129 131 76 103 + 965 1 160 125 131 103 + 966 1 122 160 129 103 + 967 1 160 131 129 103 + 968 1 59 90 82 92 + 969 1 122 82 114 92 + 970 1 82 90 114 92 + 971 1 114 137 122 92 + 972 1 114 90 137 92 + 973 1 36 63 64 92 + 974 1 76 63 36 92 + 975 1 76 36 59 92 + 976 1 36 64 59 92 End Elements -Begin Conditions Condition3D3N// GUI group identifier: Structure_interface +Begin Conditions Condition3D3N// GUI group identifier: Solid_interface 1 0 208 210 225 2 0 210 227 225 3 0 184 188 208 @@ -2580,7 +2580,7 @@ Begin SubModelPart Parts_Solid // Group Structure // Subtree Parts Begin SubModelPartConditions End SubModelPartConditions End SubModelPart -Begin SubModelPart Structure_interface // Group Structure_interface // Subtree SurfacePressure3D +Begin SubModelPart Solid_interface // Group Solid_interface // Subtree SurfacePressure3D Begin SubModelPartNodes 1 2 diff --git a/applications/FSIapplication/tests/NonConformantOneSideMapTwoFaces3D_test1/solid_mesh.mdpa b/applications/FSIapplication/tests/NonConformantOneSideMapTest/3D_solid_mesh_two_faces_test.mdpa similarity index 60% rename from applications/FSIapplication/tests/NonConformantOneSideMapTwoFaces3D_test1/solid_mesh.mdpa rename to applications/FSIapplication/tests/NonConformantOneSideMapTest/3D_solid_mesh_two_faces_test.mdpa index 7fed2c57d999..dd19ac52dbc2 100644 --- a/applications/FSIapplication/tests/NonConformantOneSideMapTwoFaces3D_test1/solid_mesh.mdpa +++ b/applications/FSIapplication/tests/NonConformantOneSideMapTest/3D_solid_mesh_two_faces_test.mdpa @@ -5,10 +5,10 @@ End ModelPartData Begin Properties 0 End Properties Begin Properties 2 - THICKNESS 1.00000E-01 - DENSITY 7.85000E+03 - YOUNG_MODULUS 2.06900E+11 - POISSON_RATIO 2.90000E-01 + THICKNESS 1.00000E-01 + DENSITY 7.85000E+03 + YOUNG_MODULUS 2.06900E+11 + POISSON_RATIO 2.90000E-01 End Properties Begin Nodes @@ -191,309 +191,309 @@ End Nodes Begin Elements ShellThinElement3D3N// GUI group identifier: Structure - 7661 2 1348 1379 1304 - 7662 2 1379 1419 1304 - 7663 2 1419 1455 1350 - 7664 2 1455 1489 1388 - 7665 2 1489 1523 1439 - 7666 2 1523 1553 1479 - 7667 2 1553 1583 1512 - 7668 2 1583 1617 1549 - 7669 2 1617 1640 1595 - 7670 2 1595 1660 1627 - 7671 2 617 548 578 - 7672 2 548 478 578 - 7673 2 478 417 494 - 7674 2 417 357 434 - 7675 2 357 305 381 - 7676 2 305 267 331 - 7677 2 267 230 289 - 7678 2 230 210 257 - 7679 2 210 188 215 - 7680 2 215 169 202 - 7681 2 1304 1419 1350 - 7682 2 1304 1350 1240 - 7683 2 1348 1304 1239 - 7684 2 1350 1455 1388 - 7685 2 1350 1388 1279 - 7686 2 1388 1489 1439 - 7687 2 1388 1439 1327 - 7688 2 1439 1523 1479 - 7689 2 1439 1479 1377 - 7690 2 1479 1553 1512 - 7691 2 1479 1512 1430 - 7692 2 1512 1583 1549 - 7693 2 1512 1549 1474 - 7694 2 1549 1617 1595 - 7695 2 1549 1595 1511 - 7696 2 1595 1640 1660 - 7697 2 578 478 494 - 7698 2 578 494 591 - 7699 2 617 578 692 - 7700 2 494 417 434 - 7701 2 494 434 522 - 7702 2 434 357 381 - 7703 2 434 381 458 - 7704 2 381 305 331 - 7705 2 381 331 399 - 7706 2 331 267 289 - 7707 2 331 289 347 - 7708 2 289 230 257 - 7709 2 289 257 314 - 7710 2 257 210 215 - 7711 2 257 215 279 - 7712 2 215 188 169 - 7713 2 1240 1350 1279 - 7714 2 1240 1279 1171 - 7715 2 1304 1240 1198 - 7716 2 1279 1388 1327 - 7717 2 1279 1327 1220 - 7718 2 1327 1439 1377 - 7719 2 1327 1377 1263 - 7720 2 1377 1479 1430 - 7721 2 1377 1430 1313 - 7722 2 1430 1512 1474 - 7723 2 1430 1474 1371 - 7724 2 1474 1549 1511 - 7725 2 1474 1511 1429 - 7726 2 1511 1595 1554 - 7727 2 591 494 522 - 7728 2 591 522 610 - 7729 2 578 591 668 - 7730 2 522 434 458 - 7731 2 522 458 549 - 7732 2 458 381 399 - 7733 2 458 399 485 - 7734 2 399 331 347 - 7735 2 399 347 433 - 7736 2 347 289 314 - 7737 2 347 314 384 - 7738 2 314 257 279 - 7739 2 314 279 339 - 7740 2 279 215 243 - 7741 2 1171 1279 1220 - 7742 2 1171 1220 1096 - 7743 2 1240 1171 1117 - 7744 2 1220 1327 1263 - 7745 2 1220 1263 1146 - 7746 2 1263 1377 1313 - 7747 2 1263 1313 1207 - 7748 2 1313 1430 1371 - 7749 2 1313 1371 1257 - 7750 2 1371 1474 1429 - 7751 2 1371 1429 1312 - 7752 2 1429 1511 1481 - 7753 2 610 522 549 - 7754 2 610 549 648 - 7755 2 591 610 691 - 7756 2 549 458 485 - 7757 2 549 485 583 - 7758 2 485 399 433 - 7759 2 485 433 523 - 7760 2 433 347 384 - 7761 2 433 384 468 - 7762 2 384 314 339 - 7763 2 384 339 422 - 7764 2 339 279 299 - 7765 2 1096 1220 1146 - 7766 2 1096 1146 1032 - 7767 2 1171 1096 1045 - 7768 2 1146 1263 1207 - 7769 2 1146 1207 1087 - 7770 2 1207 1313 1257 - 7771 2 1207 1257 1143 - 7772 2 1257 1371 1312 - 7773 2 1257 1312 1208 - 7774 2 1312 1429 1380 - 7775 2 648 549 583 - 7776 2 648 583 687 - 7777 2 610 648 723 - 7778 2 583 485 523 - 7779 2 583 523 614 - 7780 2 523 433 468 - 7781 2 523 468 556 - 7782 2 468 384 422 - 7783 2 468 422 499 - 7784 2 422 339 373 - 7785 2 1032 1146 1087 - 7786 2 1032 1087 967 - 7787 2 1096 1032 976 - 7788 2 1087 1207 1143 - 7789 2 1087 1143 1028 - 7790 2 1143 1257 1208 - 7791 2 1143 1208 1088 - 7792 2 1208 1312 1268 - 7793 2 687 583 614 - 7794 2 687 614 729 - 7795 2 648 687 759 - 7796 2 614 523 556 - 7797 2 614 556 664 - 7798 2 556 468 499 - 7799 2 556 499 602 - 7800 2 499 422 449 - 7801 2 967 1087 1028 - 7802 2 967 1028 909 - 7803 2 1032 967 918 - 7804 2 1028 1143 1088 - 7805 2 1028 1088 968 - 7806 2 1088 1208 1154 - 7807 2 729 614 664 - 7808 2 729 664 788 - 7809 2 687 729 800 - 7810 2 664 556 602 - 7811 2 664 602 724 - 7812 2 602 499 545 - 7813 2 909 1028 968 - 7814 2 909 968 848 - 7815 2 967 909 860 - 7816 2 968 1088 1037 - 7817 2 788 664 724 - 7818 2 788 724 848 - 7819 2 729 788 859 - 7820 2 724 602 669 - 7821 2 848 968 907 - 7822 2 909 848 794 - 7823 2 1198 1240 1117 - 7824 2 1198 1117 1010 - 7825 2 1304 1198 1239 - 7826 2 1554 1595 1627 - 7827 2 1511 1554 1481 - 7828 2 1481 1554 1510 - 7829 2 668 591 691 - 7830 2 668 691 839 - 7831 2 578 668 692 - 7832 2 243 215 202 - 7833 2 279 243 299 - 7834 2 299 243 286 - 7835 2 1117 1171 1045 - 7836 2 1117 1045 1004 - 7837 2 1429 1481 1380 - 7838 2 1380 1481 1446 - 7839 2 691 610 723 - 7840 2 691 723 805 - 7841 2 339 299 373 - 7842 2 373 299 333 - 7843 2 1045 1096 976 - 7844 2 1045 976 941 - 7845 2 1312 1380 1268 - 7846 2 1268 1380 1333 - 7847 2 723 648 759 - 7848 2 723 759 829 - 7849 2 422 373 449 - 7850 2 449 373 411 - 7851 2 976 1032 918 - 7852 2 976 918 876 - 7853 2 1208 1268 1154 - 7854 2 1154 1268 1225 - 7855 2 759 687 800 - 7856 2 759 800 875 - 7857 2 499 449 545 - 7858 2 545 449 492 - 7859 2 918 967 860 - 7860 2 918 860 813 - 7861 2 1088 1154 1037 - 7862 2 1037 1154 1105 - 7863 2 800 729 859 - 7864 2 800 859 932 - 7865 2 602 545 669 - 7866 2 669 545 604 - 7867 2 860 909 794 - 7868 2 860 794 750 - 7869 2 968 1037 907 - 7870 2 907 1037 992 - 7871 2 859 788 907 - 7872 2 907 788 848 - 7873 2 724 669 794 - 7874 2 724 794 848 - 7875 2 1004 1045 941 - 7876 2 1004 941 900 - 7877 2 1117 1004 1010 - 7878 2 1010 1004 900 - 7879 2 1446 1481 1510 - 7880 2 1446 1510 1445 - 7881 2 1380 1446 1333 - 7882 2 1333 1446 1445 - 7883 2 805 723 829 - 7884 2 805 829 922 - 7885 2 691 805 839 - 7886 2 839 805 922 - 7887 2 333 299 286 - 7888 2 333 286 342 - 7889 2 373 333 411 - 7890 2 411 333 342 - 7891 2 941 976 876 - 7892 2 941 876 824 - 7893 2 1268 1333 1225 - 7894 2 1225 1333 1294 - 7895 2 829 759 875 - 7896 2 829 875 949 - 7897 2 449 411 492 - 7898 2 492 411 446 - 7899 2 876 918 813 - 7900 2 876 813 758 - 7901 2 1154 1225 1105 - 7902 2 1105 1225 1184 - 7903 2 875 800 932 - 7904 2 875 932 1025 - 7905 2 545 492 604 - 7906 2 604 492 558 - 7907 2 813 860 750 - 7908 2 813 750 693 - 7909 2 1037 1105 992 - 7910 2 992 1105 1066 - 7911 2 932 859 992 - 7912 2 992 859 907 - 7913 2 669 604 750 - 7914 2 669 750 794 - 7915 2 824 876 758 - 7916 2 824 758 689 - 7917 2 941 824 900 - 7918 2 1294 1333 1445 - 7919 2 1225 1294 1184 - 7920 2 1184 1294 1267 - 7921 2 949 875 1025 - 7922 2 949 1025 1089 - 7923 2 829 949 922 - 7924 2 446 411 342 - 7925 2 492 446 558 - 7926 2 558 446 493 - 7927 2 758 813 693 - 7928 2 758 693 645 - 7929 2 1105 1184 1066 - 7930 2 1066 1184 1139 - 7931 2 1025 932 1066 - 7932 2 1066 932 992 - 7933 2 604 558 693 - 7934 2 604 693 750 - 7935 2 645 693 558 - 7936 2 758 645 689 - 7937 2 1139 1184 1267 - 7938 2 1066 1139 1025 - 7939 2 1627 1575 1554 - 7940 2 1554 1575 1510 - 7941 2 1445 1357 1294 - 7942 2 1294 1357 1267 - 7943 2 1267 1183 1139 - 7944 2 1139 1183 1025 - 7945 2 1025 1183 1089 - 7946 2 1089 1000 949 - 7947 2 949 1000 922 - 7948 2 839 765 668 - 7949 2 668 765 692 - 7950 2 202 229 243 - 7951 2 243 229 286 - 7952 2 342 418 446 - 7953 2 446 418 493 - 7954 2 645 590 689 - 7955 2 590 645 558 - 7956 2 590 558 493 - 7957 2 689 797 824 - 7958 2 824 797 900 - 7959 2 1010 1118 1198 - 7960 2 1198 1118 1239 + 7661 2 1348 1379 1304 + 7662 2 1379 1419 1304 + 7663 2 1419 1455 1350 + 7664 2 1455 1489 1388 + 7665 2 1489 1523 1439 + 7666 2 1523 1553 1479 + 7667 2 1553 1583 1512 + 7668 2 1583 1617 1549 + 7669 2 1617 1640 1595 + 7670 2 1595 1660 1627 + 7671 2 617 548 578 + 7672 2 548 478 578 + 7673 2 478 417 494 + 7674 2 417 357 434 + 7675 2 357 305 381 + 7676 2 305 267 331 + 7677 2 267 230 289 + 7678 2 230 210 257 + 7679 2 210 188 215 + 7680 2 215 169 202 + 7681 2 1304 1419 1350 + 7682 2 1304 1350 1240 + 7683 2 1348 1304 1239 + 7684 2 1350 1455 1388 + 7685 2 1350 1388 1279 + 7686 2 1388 1489 1439 + 7687 2 1388 1439 1327 + 7688 2 1439 1523 1479 + 7689 2 1439 1479 1377 + 7690 2 1479 1553 1512 + 7691 2 1479 1512 1430 + 7692 2 1512 1583 1549 + 7693 2 1512 1549 1474 + 7694 2 1549 1617 1595 + 7695 2 1549 1595 1511 + 7696 2 1595 1640 1660 + 7697 2 578 478 494 + 7698 2 578 494 591 + 7699 2 617 578 692 + 7700 2 494 417 434 + 7701 2 494 434 522 + 7702 2 434 357 381 + 7703 2 434 381 458 + 7704 2 381 305 331 + 7705 2 381 331 399 + 7706 2 331 267 289 + 7707 2 331 289 347 + 7708 2 289 230 257 + 7709 2 289 257 314 + 7710 2 257 210 215 + 7711 2 257 215 279 + 7712 2 215 188 169 + 7713 2 1240 1350 1279 + 7714 2 1240 1279 1171 + 7715 2 1304 1240 1198 + 7716 2 1279 1388 1327 + 7717 2 1279 1327 1220 + 7718 2 1327 1439 1377 + 7719 2 1327 1377 1263 + 7720 2 1377 1479 1430 + 7721 2 1377 1430 1313 + 7722 2 1430 1512 1474 + 7723 2 1430 1474 1371 + 7724 2 1474 1549 1511 + 7725 2 1474 1511 1429 + 7726 2 1511 1595 1554 + 7727 2 591 494 522 + 7728 2 591 522 610 + 7729 2 578 591 668 + 7730 2 522 434 458 + 7731 2 522 458 549 + 7732 2 458 381 399 + 7733 2 458 399 485 + 7734 2 399 331 347 + 7735 2 399 347 433 + 7736 2 347 289 314 + 7737 2 347 314 384 + 7738 2 314 257 279 + 7739 2 314 279 339 + 7740 2 279 215 243 + 7741 2 1171 1279 1220 + 7742 2 1171 1220 1096 + 7743 2 1240 1171 1117 + 7744 2 1220 1327 1263 + 7745 2 1220 1263 1146 + 7746 2 1263 1377 1313 + 7747 2 1263 1313 1207 + 7748 2 1313 1430 1371 + 7749 2 1313 1371 1257 + 7750 2 1371 1474 1429 + 7751 2 1371 1429 1312 + 7752 2 1429 1511 1481 + 7753 2 610 522 549 + 7754 2 610 549 648 + 7755 2 591 610 691 + 7756 2 549 458 485 + 7757 2 549 485 583 + 7758 2 485 399 433 + 7759 2 485 433 523 + 7760 2 433 347 384 + 7761 2 433 384 468 + 7762 2 384 314 339 + 7763 2 384 339 422 + 7764 2 339 279 299 + 7765 2 1096 1220 1146 + 7766 2 1096 1146 1032 + 7767 2 1171 1096 1045 + 7768 2 1146 1263 1207 + 7769 2 1146 1207 1087 + 7770 2 1207 1313 1257 + 7771 2 1207 1257 1143 + 7772 2 1257 1371 1312 + 7773 2 1257 1312 1208 + 7774 2 1312 1429 1380 + 7775 2 648 549 583 + 7776 2 648 583 687 + 7777 2 610 648 723 + 7778 2 583 485 523 + 7779 2 583 523 614 + 7780 2 523 433 468 + 7781 2 523 468 556 + 7782 2 468 384 422 + 7783 2 468 422 499 + 7784 2 422 339 373 + 7785 2 1032 1146 1087 + 7786 2 1032 1087 967 + 7787 2 1096 1032 976 + 7788 2 1087 1207 1143 + 7789 2 1087 1143 1028 + 7790 2 1143 1257 1208 + 7791 2 1143 1208 1088 + 7792 2 1208 1312 1268 + 7793 2 687 583 614 + 7794 2 687 614 729 + 7795 2 648 687 759 + 7796 2 614 523 556 + 7797 2 614 556 664 + 7798 2 556 468 499 + 7799 2 556 499 602 + 7800 2 499 422 449 + 7801 2 967 1087 1028 + 7802 2 967 1028 909 + 7803 2 1032 967 918 + 7804 2 1028 1143 1088 + 7805 2 1028 1088 968 + 7806 2 1088 1208 1154 + 7807 2 729 614 664 + 7808 2 729 664 788 + 7809 2 687 729 800 + 7810 2 664 556 602 + 7811 2 664 602 724 + 7812 2 602 499 545 + 7813 2 909 1028 968 + 7814 2 909 968 848 + 7815 2 967 909 860 + 7816 2 968 1088 1037 + 7817 2 788 664 724 + 7818 2 788 724 848 + 7819 2 729 788 859 + 7820 2 724 602 669 + 7821 2 848 968 907 + 7822 2 909 848 794 + 7823 2 1198 1240 1117 + 7824 2 1198 1117 1010 + 7825 2 1304 1198 1239 + 7826 2 1554 1595 1627 + 7827 2 1511 1554 1481 + 7828 2 1481 1554 1510 + 7829 2 668 591 691 + 7830 2 668 691 839 + 7831 2 578 668 692 + 7832 2 243 215 202 + 7833 2 279 243 299 + 7834 2 299 243 286 + 7835 2 1117 1171 1045 + 7836 2 1117 1045 1004 + 7837 2 1429 1481 1380 + 7838 2 1380 1481 1446 + 7839 2 691 610 723 + 7840 2 691 723 805 + 7841 2 339 299 373 + 7842 2 373 299 333 + 7843 2 1045 1096 976 + 7844 2 1045 976 941 + 7845 2 1312 1380 1268 + 7846 2 1268 1380 1333 + 7847 2 723 648 759 + 7848 2 723 759 829 + 7849 2 422 373 449 + 7850 2 449 373 411 + 7851 2 976 1032 918 + 7852 2 976 918 876 + 7853 2 1208 1268 1154 + 7854 2 1154 1268 1225 + 7855 2 759 687 800 + 7856 2 759 800 875 + 7857 2 499 449 545 + 7858 2 545 449 492 + 7859 2 918 967 860 + 7860 2 918 860 813 + 7861 2 1088 1154 1037 + 7862 2 1037 1154 1105 + 7863 2 800 729 859 + 7864 2 800 859 932 + 7865 2 602 545 669 + 7866 2 669 545 604 + 7867 2 860 909 794 + 7868 2 860 794 750 + 7869 2 968 1037 907 + 7870 2 907 1037 992 + 7871 2 859 788 907 + 7872 2 907 788 848 + 7873 2 724 669 794 + 7874 2 724 794 848 + 7875 2 1004 1045 941 + 7876 2 1004 941 900 + 7877 2 1117 1004 1010 + 7878 2 1010 1004 900 + 7879 2 1446 1481 1510 + 7880 2 1446 1510 1445 + 7881 2 1380 1446 1333 + 7882 2 1333 1446 1445 + 7883 2 805 723 829 + 7884 2 805 829 922 + 7885 2 691 805 839 + 7886 2 839 805 922 + 7887 2 333 299 286 + 7888 2 333 286 342 + 7889 2 373 333 411 + 7890 2 411 333 342 + 7891 2 941 976 876 + 7892 2 941 876 824 + 7893 2 1268 1333 1225 + 7894 2 1225 1333 1294 + 7895 2 829 759 875 + 7896 2 829 875 949 + 7897 2 449 411 492 + 7898 2 492 411 446 + 7899 2 876 918 813 + 7900 2 876 813 758 + 7901 2 1154 1225 1105 + 7902 2 1105 1225 1184 + 7903 2 875 800 932 + 7904 2 875 932 1025 + 7905 2 545 492 604 + 7906 2 604 492 558 + 7907 2 813 860 750 + 7908 2 813 750 693 + 7909 2 1037 1105 992 + 7910 2 992 1105 1066 + 7911 2 932 859 992 + 7912 2 992 859 907 + 7913 2 669 604 750 + 7914 2 669 750 794 + 7915 2 824 876 758 + 7916 2 824 758 689 + 7917 2 941 824 900 + 7918 2 1294 1333 1445 + 7919 2 1225 1294 1184 + 7920 2 1184 1294 1267 + 7921 2 949 875 1025 + 7922 2 949 1025 1089 + 7923 2 829 949 922 + 7924 2 446 411 342 + 7925 2 492 446 558 + 7926 2 558 446 493 + 7927 2 758 813 693 + 7928 2 758 693 645 + 7929 2 1105 1184 1066 + 7930 2 1066 1184 1139 + 7931 2 1025 932 1066 + 7932 2 1066 932 992 + 7933 2 604 558 693 + 7934 2 604 693 750 + 7935 2 645 693 558 + 7936 2 758 645 689 + 7937 2 1139 1184 1267 + 7938 2 1066 1139 1025 + 7939 2 1627 1575 1554 + 7940 2 1554 1575 1510 + 7941 2 1445 1357 1294 + 7942 2 1294 1357 1267 + 7943 2 1267 1183 1139 + 7944 2 1139 1183 1025 + 7945 2 1025 1183 1089 + 7946 2 1089 1000 949 + 7947 2 949 1000 922 + 7948 2 839 765 668 + 7949 2 668 765 692 + 7950 2 202 229 243 + 7951 2 243 229 286 + 7952 2 342 418 446 + 7953 2 446 418 493 + 7954 2 645 590 689 + 7955 2 590 645 558 + 7956 2 590 558 493 + 7957 2 689 797 824 + 7958 2 824 797 900 + 7959 2 1010 1118 1198 + 7960 2 1198 1118 1239 End Elements -Begin Conditions SurfaceCondition3D3N// GUI group identifier: Structure_interface +Begin Conditions SurfaceCondition3D3N// GUI group identifier: Solid_interface 1 0 1348 1379 1304 2 0 1379 1419 1304 3 0 1419 1455 1350 @@ -1279,7 +1279,7 @@ Begin SubModelPart Parts_Structure // Group Structure // Subtree Parts Begin SubModelPartConditions End SubModelPartConditions End SubModelPart -Begin SubModelPart Structure_interface // Group Structure_interface // Subtree StructureInterface3D +Begin SubModelPart Solid_interface // Group Solid_interface // Subtree StructureInterface3D Begin SubModelPartNodes 169 188 diff --git a/applications/FSIapplication/tests/NonConformantOneSideMapTwoFaces3D_test1/NonConformantOneSideMapTwoFaces3D_test1_parameters.json b/applications/FSIapplication/tests/NonConformantOneSideMapTwoFaces3D_test1/NonConformantOneSideMapTwoFaces3D_test1_parameters.json deleted file mode 100644 index 293910dc899c..000000000000 --- a/applications/FSIapplication/tests/NonConformantOneSideMapTwoFaces3D_test1/NonConformantOneSideMapTwoFaces3D_test1_parameters.json +++ /dev/null @@ -1,94 +0,0 @@ -{ - "structure_solver_settings" : { - "problem_data" : { - "problem_name" : "NonConformantOneSideMapTwoFaces3D_test1", - "model_part_name" : "Structure", - "domain_size" : 3 - }, - "solver_settings" : { - "model_import_settings" : { - "input_type" : "mdpa", - "input_filename" : "NonConformantOneSideMapTwoFaces3D_test1/solid_mesh" - }, - "problem_domain_sub_model_part_list" : ["Parts_Structure"], - "processes_sub_model_part_list" : ["Structure_interface"] - }, - "constraints_process_list" : [{ - "python_module" : "NonConformantOneSideMapTwoFaces3D_test1_structure_local_process", - "kratos_module" : "KratosMultiphysics.FSIApplication", - "help" : [], - "process_name" : "ApplyLocalProcess", - "Parameters" : { - "mesh_id" : 0, - "structure_interface_modelpart_name" : "Structure_interface" - } - }], - "output_configuration" : { - "result_file_configuration" : { - "gidpost_flags" : { - "GiDPostMode" : "GiD_PostBinary", - "WriteDeformedMeshFlag" : "WriteDeformed", - "WriteConditionsFlag" : "WriteConditions", - "MultiFileFlag" : "SingleFile" - }, - "file_label" : "step", - "output_control_type" : "step", - "output_frequency" : 1.0, - "body_output" : true, - "node_output" : false, - "skin_output" : false, - "plane_output" : [], - "nodal_results" : ["VELOCITY","POSITIVE_FACE_PRESSURE","NEGATIVE_FACE_PRESSURE"], - "gauss_point_results" : [] - }, - "point_data_configuration" : [] - } - }, - "fluid_solver_settings" : { - "problem_data" : { - "problem_name" : "NonConformantOneSideMapTwoFaces3D_test1", - "model_part_name" : "MainModelPart", - "domain_size" : 3 - }, - "output_configuration" : { - "result_file_configuration" : { - "gidpost_flags" : { - "GiDPostMode" : "GiD_PostBinary", - "WriteDeformedMeshFlag" : "WriteDeformed", - "WriteConditionsFlag" : "WriteConditions", - "MultiFileFlag" : "SingleFile" - }, - "file_label" : "step", - "output_control_type" : "step", - "output_frequency" : 1.0, - "body_output" : true, - "node_output" : false, - "skin_output" : false, - "plane_output" : [], - "nodal_results" : ["VELOCITY","PRESSURE"], - "gauss_point_results" : [] - }, - "point_data_configuration" : [] - }, - "solver_settings" : { - "model_import_settings" : { - "input_type" : "mdpa", - "input_filename" : "NonConformantOneSideMapTwoFaces3D_test1/fluid_mesh" - }, - "volume_model_part_name" : "Parts_Fluid", - "skin_parts" : ["Fluid_interface_pos","Fluid_interface_neg"], - "no_skin_parts" : [] - }, - "boundary_conditions_process_list" : [{ - "python_module" : "NonConformantOneSideMapTwoFaces3D_test1_fluid_local_process", - "kratos_module" : "KratosMultiphysics.FSIApplication", - "help" : [], - "process_name" : "ApplyLocalProcess", - "Parameters" : { - "mesh_id" : 0, - "positive_fluid_interface_modelpart_name" : "Fluid_interface_pos", - "negative_fluid_interfacemodelpart_name" : "Fluid_interface_neg" - } - }] - } -} diff --git a/applications/FSIapplication/tests/NonConformantOneSideMapTwoFaces3D_test1_fluid_local_process.py b/applications/FSIapplication/tests/NonConformantOneSideMapTwoFaces3D_test1_fluid_local_process.py deleted file mode 100644 index 5729a423500e..000000000000 --- a/applications/FSIapplication/tests/NonConformantOneSideMapTwoFaces3D_test1_fluid_local_process.py +++ /dev/null @@ -1,70 +0,0 @@ -from __future__ import print_function, absolute_import, division #makes KratosMultiphysics backward compatible with python 2.6 and 2.7 - -# Importing the Kratos Library -from KratosMultiphysics import * -from KratosMultiphysics.StructuralMechanicsApplication import * -from KratosMultiphysics.FluidDynamicsApplication import * -from KratosMultiphysics.FSIApplication import * - -CheckForPreviousImport() - -# Import KratosUnittest -import KratosMultiphysics.KratosUnittest as KratosUnittest - -def Factory(settings, Model): - if(type(settings) != Parameters): - raise Exception("Expected input shall be a Parameters object, encapsulating a json string") - return ApplyLocalProcess(Model, settings["Parameters"]) - -class ApplyLocalProcess(Process, KratosUnittest.TestCase): - - def __init__(self,Model,params): - - self.positive_interface_model_part = Model[params["positive_fluid_interface_modelpart_name"].GetString()] - self.negative_interface_model_part = Model[params["negative_fluid_interfacemodelpart_name"].GetString()] - - - def ExecuteInitialize(self): - # Assign the PRESSURE values - for node_pos, node_neg in zip(self.positive_interface_model_part.Nodes, self.negative_interface_model_part.Nodes): - if (node_neg.Id == node_pos.Id): - node_pos.SetSolutionStepValue(PRESSURE, 0, 0.0) # If the node is shared, set a unique value - else: - node_pos.SetSolutionStepValue(PRESSURE, 0, -(-36.07*node_pos.Y*node_pos.Y+36.04*node_pos.Y-8)*(8*node_pos.Z-16*node_pos.Z*node_pos.Z)) # Positive face nodal values - node_neg.SetSolutionStepValue(PRESSURE, 0, (-36.07*node_neg.Y*node_neg.Y+36.04*node_neg.Y-8)*(8*node_neg.Z-16*node_neg.Z*node_neg.Z)) # Negative face nodal values - - - def ExecuteBeforeSolutionLoop(self): - pass - - - def ExecuteInitializeSolutionStep(self): - pass - - - def ExecuteFinalizeSolutionStep(self): - pass - - - def ExecuteBeforeOutputStep(self): - pass - - - def ExecuteAfterOutputStep(self): - pass - - - def ExecuteFinalize(self): - # Mapped VELOCITY check in positive interface - for node in self.positive_interface_model_part.Nodes: - obtained_velocity_value = node.GetSolutionStepValue(VELOCITY,0) - expected_velocity_value = [-(2*node.Z-node.Y*node.Z/2.0) , 2*node.Z-node.Y*node.Z/2.0, node.X*node.Y] - for i in range(0,3): - self.assertAlmostEqual(obtained_velocity_value[i], expected_velocity_value[i], delta=5e-3) - - # Mapped VELOCITY check in negative interface - for node in self.negative_interface_model_part.Nodes: - obtained_velocity_value = node.GetSolutionStepValue(VELOCITY,0) - expected_velocity_value = [-(2*node.Z-node.Y*node.Z/2.0) , 2*node.Z-node.Y*node.Z/2.0, node.X*node.Y] - for i in range(0,3): - self.assertAlmostEqual(obtained_velocity_value[i], expected_velocity_value[i], delta=5e-3) diff --git a/applications/FSIapplication/tests/NonConformantOneSideMapTwoFaces3D_test1_structure_local_process.py b/applications/FSIapplication/tests/NonConformantOneSideMapTwoFaces3D_test1_structure_local_process.py deleted file mode 100644 index 5502bc9950df..000000000000 --- a/applications/FSIapplication/tests/NonConformantOneSideMapTwoFaces3D_test1_structure_local_process.py +++ /dev/null @@ -1,64 +0,0 @@ -from __future__ import print_function, absolute_import, division #makes KratosMultiphysics backward compatible with python 2.6 and 2.7 - -# Importing the Kratos Library -from KratosMultiphysics import * -from KratosMultiphysics.StructuralMechanicsApplication import * -from KratosMultiphysics.FluidDynamicsApplication import * -from KratosMultiphysics.FSIApplication import * - -CheckForPreviousImport() - -# Import KratosUnittest -import KratosMultiphysics.KratosUnittest as KratosUnittest - -def Factory(settings, Model): - if(type(settings) != Parameters): - raise Exception("Expected input shall be a Parameters object, encapsulating a json string") - return ApplyLocalProcess(Model, settings["Parameters"]) - -class ApplyLocalProcess(Process, KratosUnittest.TestCase): - - def __init__(self,Model,params): - - self.structure_interface_model_part = Model[params["structure_interface_modelpart_name"].GetString()] - - - def ExecuteInitialize(self): - # Parabolic velocity distribution - for node in self.structure_interface_model_part.Nodes: - node.SetSolutionStepValue(VELOCITY_X, 0, -(2*node.Z - node.Y*node.Z/2.0)) - node.SetSolutionStepValue(VELOCITY_Y, 0, 2*node.Z - node.Y*node.Z/2.0) - node.SetSolutionStepValue(VELOCITY_Z, 0, node.X*node.Y) - - - def ExecuteBeforeSolutionLoop(self): - pass - - - def ExecuteInitializeSolutionStep(self): - pass - - - def ExecuteFinalizeSolutionStep(self): - pass - - - def ExecuteBeforeOutputStep(self): - pass - - - def ExecuteAfterOutputStep(self): - pass - - - def ExecuteFinalize(self): - # Mapped PRESSURE check - for node in self.structure_interface_model_part.Nodes: - obtained_pressure_value = node.GetSolutionStepValue(POSITIVE_FACE_PRESSURE,0) - expected_pressure_value = -(-36.07*node.Y*node.Y+36.04*node.Y-8)*(8*node.Z-16*node.Z*node.Z) - self.assertAlmostEqual(obtained_pressure_value, expected_pressure_value, delta=2.5e-2) - - for node in self.structure_interface_model_part.Nodes: - obtained_pressure_value = node.GetSolutionStepValue(NEGATIVE_FACE_PRESSURE,0) - expected_pressure_value = (-36.07*node.Y*node.Y+36.04*node.Y-8)*(8*node.Z-16*node.Z*node.Z) - self.assertAlmostEqual(obtained_pressure_value, expected_pressure_value, delta=2.5e-2) diff --git a/applications/FSIapplication/tests/SmallTests.py b/applications/FSIapplication/tests/SmallTests.py deleted file mode 100644 index 2017bfdf6836..000000000000 --- a/applications/FSIapplication/tests/SmallTests.py +++ /dev/null @@ -1,130 +0,0 @@ -import os - -# Import Kratos -from KratosMultiphysics import * - -# Import KratosUnittest -import KratosMultiphysics.KratosUnittest as KratosUnittest -import KratosExecuteMapperTest as ExecuteMapperTest -import KratosExecuteMapperTwoFacesTest as ExecuteMapperTwoFacesTest -import KratosExecuteConvergenceAcceleratorTest as ExecuteConvergenceAcceleratorTest -import KratosExecuteFSIProblemEmulatorTest as ExecuteFSIProblemEmulatorTest - -try: - from KratosMultiphysics.StructuralMechanicsApplication import * - from KratosMultiphysics.FluidDynamicsApplication import * - missing_external_dependencies = False - missing_application = '' -except ImportError as e: - missing_external_dependencies = True - # extract name of the missing application from the error message - import re - missing_application = re.search(r'''.*'KratosMultiphysics\.(.*)'.*''','{0}'.format(e)).group(1) - -# This utiltiy will control the execution scope in case we need to acces files or we depend -# on specific relative locations of the files. - -# TODO: Should we move this to KratosUnittest? -class controlledExecutionScope: - def __init__(self, scope): - self.currentPath = os.getcwd() - self.scope = scope - - def __enter__(self): - os.chdir(self.scope) - - def __exit__(self, type, value, traceback): - os.chdir(self.currentPath) - - -class MapperTestFactory(KratosUnittest.TestCase): - - def setUp(self): - # Within this location context: - with controlledExecutionScope(os.path.dirname(os.path.realpath(__file__))): - # Get the ProjectParameters file - parameter_file = open(self.file_name + "_parameters.json", 'r') - ProjectParameters = Parameters(parameter_file.read()) - - # Create the test - self.test = ExecuteMapperTest.KratosExecuteMapperTest(ProjectParameters) - - def test_execution(self): - # Within this location context: - with controlledExecutionScope(os.path.dirname(os.path.realpath(__file__))): - self.test.Solve() - - def tearDown(self): - pass - - -class TwoFacesMapperTestFactory(KratosUnittest.TestCase): - - def setUp(self): - # Within this location context: - with controlledExecutionScope(os.path.dirname(os.path.realpath(__file__))): - # Get the ProjectParameters file - parameter_file = open(self.file_name + "_parameters.json", 'r') - ProjectParameters = Parameters(parameter_file.read()) - - # Create the test - self.test = ExecuteMapperTwoFacesTest.KratosExecuteTwoFacesMapperTest(ProjectParameters) - - def test_execution(self): - # Within this location context: - with controlledExecutionScope(os.path.dirname(os.path.realpath(__file__))): - self.test.Solve() - - def tearDown(self): - pass - - -class FSIProblemEmulatorTestFactory(KratosUnittest.TestCase): - - def setUp(self): - self.test_list = [] - - # Within this location context: - with controlledExecutionScope(os.path.dirname(os.path.realpath(__file__))): - # Iterate in the convergence accelerators test list - for parameter_file_name in self.file_name_list: - # Get the ProjectParameters file - parameter_file = open(parameter_file_name + "_parameters.json", 'r') - ProjectParameters = Parameters(parameter_file.read()) - - # Create the test - self.test_list.append(ExecuteFSIProblemEmulatorTest.KratosExecuteFSIProblemEmulatorTest(ProjectParameters)) - - def test_execution(self): - # Within this location context: - with controlledExecutionScope(os.path.dirname(os.path.realpath(__file__))): - # Iterate in the convergence accelerators test list - for test in self.test_list: - test.Solve() - - def tearDown(self): - pass - -@KratosUnittest.skipIf(missing_external_dependencies, "Missing required application: {0}".format(missing_application)) -class NonConformantOneSideMap2D_test1(MapperTestFactory): - file_name = "NonConformantOneSideMap2D_test1/NonConformantOneSideMap2D_test1" - -@KratosUnittest.skipIf(missing_external_dependencies, "Missing required application: {0}".format(missing_application)) -class NonConformantOneSideMap2D_test2(MapperTestFactory): - file_name = "NonConformantOneSideMap2D_test2/NonConformantOneSideMap2D_test2" - -@KratosUnittest.skipIf(missing_external_dependencies, "Missing required application: {0}".format(missing_application)) -class NonConformantOneSideMap3D_test1(MapperTestFactory): - file_name = "NonConformantOneSideMap3D_test1/NonConformantOneSideMap3D_test1" - -@KratosUnittest.skipIf(missing_external_dependencies, "Missing required application: {0}".format(missing_application)) -class NonConformantOneSideMapTwoFaces3D_test1(TwoFacesMapperTestFactory): - file_name = "NonConformantOneSideMapTwoFaces3D_test1/NonConformantOneSideMapTwoFaces3D_test1" - -@KratosUnittest.skipIf(missing_external_dependencies, "Missing required application: {0}".format(missing_application)) -class FSIProblemEmulatorTest(FSIProblemEmulatorTestFactory): - file_name_1 = "FSIProblemEmulatorTest/FSIProblemEmulatorTest_Aitken" - file_name_2 = "FSIProblemEmulatorTest/FSIProblemEmulatorTest_MVQN" - file_name_3 = "FSIProblemEmulatorTest/FSIProblemEmulatorTest_MVQN_recursive" - - file_name_list = [file_name_1, file_name_2, file_name_3] diff --git a/applications/FSIapplication/tests/ValidationTests.py b/applications/FSIapplication/tests/ValidationTests.py deleted file mode 100644 index 18827ff0e7b2..000000000000 --- a/applications/FSIapplication/tests/ValidationTests.py +++ /dev/null @@ -1,48 +0,0 @@ -import os - -# Import Kratos -from KratosMultiphysics import * - -# Import KratosUnittest -import KratosMultiphysics.KratosUnittest as KratosUnittest -import KratosExecuteMokBenchmark as ExecuteMokBenchmark - -# This utiltiy will control the execution scope in case we need to acces files or we depend -# on specific relative locations of the files. - -# TODO: Should we move this to KratosUnittest? -class controlledExecutionScope: - def __init__(self, scope): - self.currentPath = os.getcwd() - self.scope = scope - - def __enter__(self): - os.chdir(self.scope) - - def __exit__(self, type, value, traceback): - os.chdir(self.currentPath) - - -class MokBenchmarkFactory(KratosUnittest.TestCase): - - def setUp(self): - # Within this location context: - with controlledExecutionScope(os.path.dirname(os.path.realpath(__file__))): - # Get the ProjectParameters file - parameter_file = open(self.file_name, 'r') - ProjectParameters = Parameters(parameter_file.read()) - - # Create the test - self.test = ExecuteMokBenchmark.KratosExecuteMokBenchmark(ProjectParameters) - - def test_execution(self): - # Within this location context: - with controlledExecutionScope(os.path.dirname(os.path.realpath(__file__))): - self.test.Solve() - - def tearDown(self): - pass - - -class MokBenchmarkTest(MokBenchmarkFactory): - file_name = "MokBenchmark/ProjectParameters.json" diff --git a/applications/FSIapplication/tests/convergence_accelerator_spring_MPI_test.py b/applications/FSIapplication/tests/convergence_accelerator_spring_MPI_test.py new file mode 100644 index 000000000000..750d4b7711ea --- /dev/null +++ b/applications/FSIapplication/tests/convergence_accelerator_spring_MPI_test.py @@ -0,0 +1,305 @@ +from __future__ import print_function, absolute_import, division # makes KratosMultiphysics backward compatible with python 2.6 and 2.7 + +import KratosMultiphysics +import KratosMultiphysics.FSIApplication as KratosFSI + +try: + from KratosMultiphysics.mpi import * + import KratosMultiphysics.MetisApplication as KratosMetis + import KratosMultiphysics.TrilinosApplication as KratosTrilinos + import KratosMultiphysics.FluidDynamicsApplication as KratosFluid +except ImportError: + pass + +import KratosMultiphysics.KratosUnittest as KratosUnittest + +import math +import convergence_accelerator_factory + +def GetFilePath(fileName): + return os.path.dirname(os.path.realpath(__file__)) + "/AcceleratorSpringTests/" + fileName + +def GetPartitionedFilePath(fileName): + return GetFilePath( "{0}_{1}".format(fileName,mpi.rank ) ) + +class ConvergenceAcceleratorSpringMPITest(KratosUnittest.TestCase): + + def constant_force(self,model_part,variable,k,reference_z): + for i,node in enumerate(model_part.Nodes): + j = 3*i + position = node.GetSolutionStepValue(KratosMultiphysics.DISPLACEMENT_Z,0) + node.Z + if node.Z > reference_z: + delta = position - reference_z + else: + delta = reference_z - position + forces = KratosMultiphysics.Array3() + forces[0] = 0.0 + forces[1] = 0.0 + forces[2] = k*delta + node.SetSolutionStepValue(variable,0,forces) + + def variable_stiffness(self,model_part,variable,k,reference_z): + for i,node in enumerate(model_part.Nodes): + j = 3*i + position = node.GetSolutionStepValue(KratosMultiphysics.DISPLACEMENT_Z,0) + node.Z + if node.Z > reference_z: + delta = position - reference_z + else: + delta = reference_z - position + forces = KratosMultiphysics.Array3() + forces[0] = 0.0 + forces[1] = 0.0 + forces[2] = k * ( 1 + node.X*node.Y ) * delta + node.SetSolutionStepValue(variable,0,forces) + + + def ComputeResidual(self,model_part,guess,force1,force2): + + force1(model_part,KratosMultiphysics.FORCE) + force2(model_part,KratosMultiphysics.REACTION) + + residual = self.space.CreateEmptyVectorPointer(self.epetra_comm) + self.partitioned_utilities.SetUpInterfaceVector(model_part,residual) + self.partitioned_utilities.ComputeInterfaceVectorResidual(model_part,KratosMultiphysics.FORCE,KratosMultiphysics.REACTION,residual.GetReference()) + return residual + + def ComputeResidualNorm(self,residual): + return self.space.TwoNorm(residual.GetReference()) + + def ReadModelPart(self,filename): + + model_part = KratosMultiphysics.ModelPart("Test ModelPart") + + model_part.AddNodalSolutionStepVariable(KratosMultiphysics.PARTITION_INDEX) + model_part.AddNodalSolutionStepVariable(KratosMultiphysics.DISPLACEMENT) + model_part.AddNodalSolutionStepVariable(KratosMultiphysics.FORCE) + model_part.AddNodalSolutionStepVariable(KratosMultiphysics.REACTION) + model_part.AddNodalSolutionStepVariable(KratosMultiphysics.FSI_INTERFACE_RESIDUAL) + mpi.world.barrier() + + KratosMetis.SetMPICommunicatorProcess(model_part).Execute() + + model_part_io = KratosMultiphysics.ModelPartIO( filename ) + model_part_io.ReadModelPart(model_part) + model_part.SetBufferSize(2) + + KratosTrilinos.ParallelFillCommunicator(model_part).Execute() + + return model_part + + def InitializeNodalEpetraVector(self,model_part,rows_per_node): + v = self.space.CreateEmptyVectorPointer(self.epetra_comm) + local_size = rows_per_node * len(model_part.GetCommunicator().LocalMesh().Nodes) + global_size = model_part.GetCommunicator().SumAll(local_size) + self.space.ResizeVector(v,int(global_size)) + return v + + def setUp(self): + + # So far, the MPI convergence accelerator tests must be run with 2 processes + if (mpi.size != 2): + raise Exception("The MPI convergence accelerator tests must be run with 2 processes.") + + self.print_gid_output = False + self.aitken_tolelance = 1e-10 + self.aitken_iterations = 50 + self.assert_delta = 1e-7 + + self.model_part = self.ReadModelPart(GetPartitionedFilePath("box_fluid")) + + self.space = KratosTrilinos.TrilinosSparseSpace() + self.epetra_comm = KratosTrilinos.CreateCommunicator() + + self.partitioned_utilities = KratosTrilinos.TrilinosPartitionedFSIUtilities3D(self.epetra_comm) + + def tearDown(self): + if self.print_gid_output: + local_nodes = self.model_part.GetCommunicator().LocalMesh().Nodes + + gid_mode = KratosMultiphysics.GiDPostMode.GiD_PostBinary + multifile = KratosMultiphysics.MultiFileFlag.SingleFile + deformed_mesh_flag = KratosMultiphysics.WriteDeformedMeshFlag.WriteUndeformed + write_conditions = KratosMultiphysics.WriteConditionsFlag.WriteConditions + + gid_io = KratosMultiphysics.GidIO(GetPartitionedFilePath("box_fluid"), + gid_mode, multifile, + deformed_mesh_flag, write_conditions) + + gid_io.InitializeMesh(0) + gid_io.WriteMesh(self.model_part.GetMesh()) + gid_io.FinalizeMesh() + + gid_io.InitializeResults(0.0,self.model_part.GetMesh()) + gid_io.WriteNodalResults(KratosMultiphysics.PARTITION_INDEX,self.model_part.Nodes,0.0,0) + gid_io.WriteNodalResults(KratosMultiphysics.DISPLACEMENT,self.model_part.Nodes,0.0,0) + gid_io.WriteNodalResults(KratosMultiphysics.FSI_INTERFACE_RESIDUAL,local_nodes,0.0,0) + gid_io.WriteNodalResults(KratosMultiphysics.FORCE,local_nodes,0.0,0) + gid_io.WriteNodalResults(KratosMultiphysics.REACTION,local_nodes,0.0,0) + gid_io.FinalizeResults() + + # clean temporary files + import os,glob + if mpi.rank == 0: + for f in glob.glob(GetFilePath('*.time')): + os.remove(f) + + # Aitken accelerator test + def test_aitken_accelerator(self,force1,force2,solution): + + aitken_settings = KratosMultiphysics.Parameters("""{ + "solver_type" : "Relaxation", + "acceleration_type" : "Aitken", + "w_0" : 0.825 + }""") + + print("") + print("Testing accelerator: ",aitken_settings["solver_type"].GetString()) + + # Construct the accelerator strategy + coupling_utility = convergence_accelerator_factory.CreateTrilinosConvergenceAccelerator(aitken_settings) + + top_part = self.model_part.GetSubModelPart("Top") + + coupling_utility.Initialize() + + nl_it = 0 + convergence = False + + coupling_utility.InitializeSolutionStep() + + x_guess = self.space.CreateEmptyVectorPointer(self.epetra_comm) + self.partitioned_utilities.SetUpInterfaceVector(top_part,x_guess) + residual = self.ComputeResidual(top_part,x_guess,force1,force2) + res_norm = self.ComputeResidualNorm(residual) + + while (nl_it <= self.aitken_iterations): + + print(mpi.rank,": Iteration: ", nl_it," residual norm: ", res_norm, file=sys.stderr) + + if res_norm > self.aitken_tolelance: + coupling_utility.InitializeNonLinearIteration() + coupling_utility.UpdateSolution(residual.GetReference(), x_guess.GetReference()) + self.partitioned_utilities.UpdateInterfaceValues(top_part,KratosMultiphysics.DISPLACEMENT,x_guess.GetReference()) + coupling_utility.FinalizeNonLinearIteration() + else: + coupling_utility.FinalizeSolutionStep() + convergence = True + break + + nl_it += 1 + residual = self.ComputeResidual(top_part,x_guess,force1,force2) + res_norm = self.ComputeResidualNorm(residual) + + # Check the obtained solution + expected_x = solution(top_part) + + for i,node in enumerate(top_part.Nodes): + expected = expected_x[3*i+2] + obtained = node.GetSolutionStepValue(KratosMultiphysics.DISPLACEMENT_Z,0) + self.assertAlmostEqual(expected,obtained,delta=self.assert_delta) + + def test_aitken_accelerator_constant_forces(self): + self.print_gid_output = False + + k1 = 100 + k2 = 500 + z_equilibrium_1 = 0.5 + z_equilibrium_2 = 1.5 + + def force1(model_part,variable): + return self.constant_force(model_part,variable,k1,z_equilibrium_1) + + def force2(model_part,variable): + return self.constant_force(model_part,variable,k2,z_equilibrium_2) + + def analytical_solution(model_part,k1,k2,z_equilibrium_1,z_equilibrium_2): + s = KratosMultiphysics.Vector(3*len(model_part.Nodes)) + dtot = z_equilibrium_2 - z_equilibrium_1 + z_solution = dtot * k2 / (k1+k2) + z_equilibrium_1 + for i,node in enumerate(model_part.Nodes): + j = 3*i + s[j] = 0.0 + s[j+1] = 0.0 + s[j+2] = z_solution - node.Z + + return s + + def solution(model_part): + return analytical_solution(model_part,k1,k2,z_equilibrium_1,z_equilibrium_2) + + self.test_aitken_accelerator(force1,force2,solution) + + def test_aitken_accelerator_variable_stiffness(self): + + k1 = 100 + k2 = 500 + z_equilibrium_1 = 0.5 + z_equilibrium_2 = 1.5 + + def forceA(model_part,variable): + return self.constant_force(model_part,variable,k1,z_equilibrium_1) + + def forceB(model_part,variable): + return self.variable_stiffness(model_part,variable,k2,z_equilibrium_2) + + def analytical_solution(model_part,k1,k2,z_equilibrium_1,z_equilibrium_2): + s = KratosMultiphysics.Vector(3*len(model_part.Nodes)) + dtot = z_equilibrium_2 - z_equilibrium_1 + for i,node in enumerate(model_part.Nodes): + k2_variable = k2 * ( 1 + node.X*node.Y ) + z_solution = dtot * k2_variable / (k1+k2_variable) + z_equilibrium_1 + j = 3*i + s[j] = 0.0 + s[j+1] = 0.0 + s[j+2] = z_solution - node.Z + + return s + + def solution(model_part): + return analytical_solution(model_part,k1,k2,z_equilibrium_1,z_equilibrium_2) + + self.test_aitken_accelerator(forceA,forceB,solution) + + def test_aitken_accelerator_ghost_nodes(self): + self.print_gid_output = False + + # relax tolerance requirements to force differences between processors + self.aitken_tolelance = 1e-2 + self.aitken_iterations = 10 + self.assert_delta = 1e-3 + + k1 = 100 + k2 = 500 + z_equilibrium_1 = 0.5 + z_equilibrium_2 = 1.5 + + def forceA(model_part,variable): + return self.constant_force(model_part,variable,k1,z_equilibrium_1) + + def forceB(model_part,variable): + return self.variable_stiffness(model_part,variable,k2,z_equilibrium_2) + + def analytical_solution(model_part,k1,k2,z_equilibrium_1,z_equilibrium_2): + s = KratosMultiphysics.Vector(3*len(model_part.Nodes)) + dtot = z_equilibrium_2 - z_equilibrium_1 + for i,node in enumerate(model_part.Nodes): + k2_variable = k2 * ( 1 + node.X*node.Y ) + z_solution = dtot * k2_variable / (k1+k2_variable) + z_equilibrium_1 + j = 3*i + s[j] = 0.0 + s[j+1] = 0.0 + s[j+2] = z_solution - node.Z + + return s + + def solution(model_part): + return analytical_solution(model_part,k1,k2,z_equilibrium_1,z_equilibrium_2) + + self.test_aitken_accelerator(forceA,forceB,solution) + + ghost_displacements = [ node.GetSolutionStepValue(KratosMultiphysics.DISPLACEMENT_Z,0) for node in self.model_part.GetCommunicator().GhostMesh(0).Nodes ] + self.model_part.GetCommunicator().SynchronizeNodalSolutionStepsData() + owner_displacements = [ node.GetSolutionStepValue(KratosMultiphysics.DISPLACEMENT_Z,0) for node in self.model_part.GetCommunicator().GhostMesh(0).Nodes ] + + for vold,vnew in zip(ghost_displacements,owner_displacements): + self.assertAlmostEqual(vold,vnew,delta=1e-7) diff --git a/applications/FSIapplication/tests/convergence_accelerator_spring_test.py b/applications/FSIapplication/tests/convergence_accelerator_spring_test.py new file mode 100644 index 000000000000..b933a7490fcc --- /dev/null +++ b/applications/FSIapplication/tests/convergence_accelerator_spring_test.py @@ -0,0 +1,245 @@ +from __future__ import print_function, absolute_import, division # makes KratosMultiphysics backward compatible with python 2.6 and 2.7 +import os + +import KratosMultiphysics +import KratosMultiphysics.FSIApplication as KratosFSI + +import KratosMultiphysics.KratosUnittest as KratosUnittest + +import math +import convergence_accelerator_factory + +def GetFilePath(fileName): + return os.path.dirname(os.path.realpath(__file__)) + "/AcceleratorSpringTests/" + fileName + +class ConvergenceAcceleratorSpringTest(KratosUnittest.TestCase): + + def constant_force(self,model_part,guess,k,reference_z): + f = KratosMultiphysics.Vector(3*len(model_part.Nodes)) + for i,node in enumerate(model_part.Nodes): + j = 3*i + position = guess[j+2] + node.Z + if node.Z > reference_z: + delta = position - reference_z + else: + delta = reference_z - position + f[j] = 0.0 + f[j+1] = 0.0 + f[j+2] = k*delta + return f + + def variable_stiffness(self,model_part,guess,k,reference_z): + f = KratosMultiphysics.Vector(3*len(model_part.Nodes)) + for i,node in enumerate(model_part.Nodes): + j = 3*i + position = guess[j+2] + node.Z + if node.Z > reference_z: + delta = position - reference_z + else: + delta = reference_z - position + f[j] = 0.0 + f[j+1] = 0.0 + f[j+2] = k * ( 1 + node.X*node.Y ) * delta + return f + + def ComputeResidual(self,model_part,guess,force1,force2): + + f = force1(model_part,guess) + g = force2(model_part,guess) + + if self.print_gid_output: + for i,node in enumerate(model_part.Nodes): + j = 3*i + node.SetSolutionStepValue(KratosMultiphysics.FSI_INTERFACE_RESIDUAL_X,0, f[j] -g[j] ) + node.SetSolutionStepValue(KratosMultiphysics.FSI_INTERFACE_RESIDUAL_Y,0, f[j+1]-g[j+1] ) + node.SetSolutionStepValue(KratosMultiphysics.FSI_INTERFACE_RESIDUAL_Z,0, f[j+2]-g[j+2] ) + + return f - g + + def InitializeGuess(self,model_part): + guess = KratosMultiphysics.Vector(3*len(model_part.Nodes)) + for i,node in enumerate(model_part.Nodes): + j = 3*i + guess[j] = 0.0 + guess[j+1] = 0.0 + guess[j+2] = 0.0 + + return guess + + def PrintGuess(self,model_part,guess): + if self.print_gid_output: + for i,node in enumerate(model_part.Nodes): + j = 3*i + node.SetSolutionStepValue(KratosMultiphysics.DISPLACEMENT_X,0, guess[j] ) + node.SetSolutionStepValue(KratosMultiphysics.DISPLACEMENT_Y,0, guess[j+1] ) + node.SetSolutionStepValue(KratosMultiphysics.DISPLACEMENT_Z,0, guess[j+2] ) + + def ComputeResidualNorm(self,residual): + norm = 0.0 + for r in residual: + norm += r*r + + return norm**0.5 + + def ReadModelPart(self,filename): + + model_part = KratosMultiphysics.ModelPart("Test ModelPart") + + model_part.AddNodalSolutionStepVariable(KratosMultiphysics.PARTITION_INDEX) + model_part.AddNodalSolutionStepVariable(KratosMultiphysics.DISPLACEMENT) + model_part.AddNodalSolutionStepVariable(KratosMultiphysics.FSI_INTERFACE_RESIDUAL) + + model_part_io = KratosMultiphysics.ModelPartIO( filename ) + model_part_io.ReadModelPart(model_part) + model_part.SetBufferSize(2) + + return model_part + + def setUp(self): + self.print_gid_output = False + self.aitken_tolelance = 1e-10 + self.aitken_iterations = 50 + self.assert_delta = 1e-7 + + self.model_part = self.ReadModelPart(GetFilePath("box_fluid")) + + def tearDown(self): + if self.print_gid_output: + local_nodes = self.model_part.GetCommunicator().LocalMesh().Nodes + + gid_mode = KratosMultiphysics.GiDPostMode.GiD_PostBinary + multifile = KratosMultiphysics.MultiFileFlag.SingleFile + deformed_mesh_flag = KratosMultiphysics.WriteDeformedMeshFlag.WriteUndeformed + write_conditions = KratosMultiphysics.WriteConditionsFlag.WriteConditions + + gid_io = KratosMultiphysics.GidIO(GetFilePath("box_fluid"), + gid_mode, multifile, + deformed_mesh_flag, write_conditions) + + gid_io.InitializeMesh(0) + gid_io.WriteMesh(self.model_part.GetMesh()) + gid_io.FinalizeMesh() + + gid_io.InitializeResults(0.0,self.model_part.GetMesh()) + gid_io.WriteNodalResults(KratosMultiphysics.PARTITION_INDEX,self.model_part.Nodes,0.0,0) + gid_io.WriteNodalResults(KratosMultiphysics.DISPLACEMENT,self.model_part.Nodes,0.0,0) + gid_io.WriteNodalResults(KratosMultiphysics.FSI_INTERFACE_RESIDUAL,local_nodes,0.0,0) + gid_io.FinalizeResults() + + # clean temporary files + import os,glob + for f in glob.glob(GetFilePath('*.time')): + os.remove(f) + + # Aitken accelerator test + def test_aitken_accelerator(self,force1,force2,solution): + + aitken_settings = KratosMultiphysics.Parameters("""{ + "solver_type" : "Relaxation", + "acceleration_type" : "Aitken", + "w_0" : 0.825 + }""") + + print("") + print("Testing accelerator: ",aitken_settings["solver_type"].GetString()) + + # Construct the accelerator strategy + coupling_utility = convergence_accelerator_factory.CreateConvergenceAccelerator(aitken_settings) + + top_part = self.model_part.GetSubModelPart("Top") + + coupling_utility.Initialize() + + nl_it = 0 + convergence = False + + coupling_utility.InitializeSolutionStep() + + x_guess = self.InitializeGuess(top_part) + residual = self.ComputeResidual(top_part,x_guess,force1,force2) + res_norm = self.ComputeResidualNorm(residual) + + while (nl_it <= self.aitken_iterations): + + if res_norm > self.aitken_tolelance: + coupling_utility.InitializeNonLinearIteration() + coupling_utility.UpdateSolution(residual, x_guess) + coupling_utility.FinalizeNonLinearIteration() + else: + coupling_utility.FinalizeSolutionStep() + convergence = True + break + + nl_it += 1 + residual = self.ComputeResidual(top_part,x_guess,force1,force2) + res_norm = self.ComputeResidualNorm(residual) + + # Check the obtained solution + expected_x = solution(top_part) + + if self.print_gid_output: + self.PrintGuess(top_part,x_guess) + + for i in range(len(expected_x)): + self.assertAlmostEqual(expected_x[i],x_guess[i],delta=self.assert_delta) + + def test_aitken_accelerator_constant_forces(self): + + k1 = 100 + k2 = 500 + z_equilibrium_1 = 0.5 + z_equilibrium_2 = 1.5 + + def force1(model_part,guess): + return self.constant_force(model_part,guess,k1,z_equilibrium_1) + + def force2(model_part,guess): + return self.constant_force(model_part,guess,k2,z_equilibrium_2) + + def analytical_solution(model_part,k1,k2,z_equilibrium_1,z_equilibrium_2): + s = KratosMultiphysics.Vector(3*len(model_part.Nodes)) + dtot = z_equilibrium_2 - z_equilibrium_1 + z_solution = dtot * k2 / (k1+k2) + z_equilibrium_1 + for i,node in enumerate(model_part.Nodes): + j = 3*i + s[j] = 0.0 + s[j+1] = 0.0 + s[j+2] = z_solution - node.Z + + return s + + def solution(model_part): + return analytical_solution(model_part,k1,k2,z_equilibrium_1,z_equilibrium_2) + + self.test_aitken_accelerator(force1,force2,solution) + + def test_aitken_accelerator_variable_stiffness(self): + + k1 = 100 + k2 = 500 + z_equilibrium_1 = 0.5 + z_equilibrium_2 = 1.5 + + def forceA(model_part,guess): + return self.constant_force(model_part,guess,k1,z_equilibrium_1) + + def forceB(model_part,guess): + return self.variable_stiffness(model_part,guess,k2,z_equilibrium_2) + + def analytical_solution(model_part,k1,k2,z_equilibrium_1,z_equilibrium_2): + s = KratosMultiphysics.Vector(3*len(model_part.Nodes)) + dtot = z_equilibrium_2 - z_equilibrium_1 + for i,node in enumerate(model_part.Nodes): + k2_variable = k2 * ( 1 + node.X*node.Y ) + z_solution = dtot * k2_variable / (k1+k2_variable) + z_equilibrium_1 + j = 3*i + s[j] = 0.0 + s[j+1] = 0.0 + s[j+2] = z_solution - node.Z + + return s + + def solution(model_part): + return analytical_solution(model_part,k1,k2,z_equilibrium_1,z_equilibrium_2) + + self.test_aitken_accelerator(forceA,forceB,solution) diff --git a/applications/FSIapplication/tests/KratosExecuteConvergenceAcceleratorTest.py b/applications/FSIapplication/tests/convergence_accelerator_test.py similarity index 99% rename from applications/FSIapplication/tests/KratosExecuteConvergenceAcceleratorTest.py rename to applications/FSIapplication/tests/convergence_accelerator_test.py index de059386b04f..ff502e03b9f9 100644 --- a/applications/FSIapplication/tests/KratosExecuteConvergenceAcceleratorTest.py +++ b/applications/FSIapplication/tests/convergence_accelerator_test.py @@ -7,7 +7,7 @@ import math import convergence_accelerator_factory -class KratosExecuteConvergenceAcceleratorTest(KratosUnittest.TestCase): +class ConvergenceAcceleratorTest(KratosUnittest.TestCase): # Residual functions def f(self,x): diff --git a/applications/FSIapplication/tests/materials.py b/applications/FSIapplication/tests/materials.py deleted file mode 100644 index 3bbb034da415..000000000000 --- a/applications/FSIapplication/tests/materials.py +++ /dev/null @@ -1,11 +0,0 @@ - -from __future__ import print_function, absolute_import, division #makes KratosMultiphysics backward compatible with python 2.6 and 2.7 -# Importing the Kratos Library -from KratosMultiphysics import * -from KratosMultiphysics.StructuralMechanicsApplication import * - -def AssignMaterial(Properties): - prop_id = 1; - prop = Properties[prop_id] - mat = LinearElasticPlaneStress2DLaw() - prop.SetValue(CONSTITUTIVE_LAW, mat.Clone()) diff --git a/applications/FSIapplication/tests/mok_benchmark_test.py b/applications/FSIapplication/tests/mok_benchmark_test.py new file mode 100644 index 000000000000..436d4fac9445 --- /dev/null +++ b/applications/FSIapplication/tests/mok_benchmark_test.py @@ -0,0 +1,204 @@ +from __future__ import print_function, absolute_import, division #makes KratosMultiphysics backward compatible with python 2.6 and 2.7 + +from KratosMultiphysics import * +from KratosMultiphysics.FSIApplication import * +try: + from KratosMultiphysics.ALEApplication import * + from KratosMultiphysics.FluidDynamicsApplication import * + from KratosMultiphysics.StructuralMechanicsApplication import * +except ImportError: + pass + +from os import remove + +import process_factory +import KratosMultiphysics.KratosUnittest as KratosUnittest + +class WorkFolderScope: + def __init__(self, work_folder): + self.currentPath = os.getcwd() + self.scope = os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__)),work_folder)) + + def __enter__(self): + os.chdir(self.scope) + + def __exit__(self, type, value, traceback): + os.chdir(self.currentPath) + +class MokBenchmarkTest(KratosUnittest.TestCase): + + def setUp(self): + self.print_output = False + self.work_folder = "MokBenchmarkTest" + self.settings = "ProjectParameters.json" + self.fluid_input_file = "mok_benchmark_Fluid" + self.structure_input_file = "mok_benchmark_Fluid" + + def tearDown(self): + self.deleteOutFile(self.fluid_input_file+'.time') + self.deleteOutFile(self.structure_input_file+'.time') + + def deleteOutFile(self,filename): + with WorkFolderScope(self.work_folder): + try: + remove(filename) + except FileNotFoundError as e: + pass + + def testMokBenchmark(self): + with WorkFolderScope(self.work_folder): + parameter_file = open(self.settings, 'r') + self.ProjectParameters = Parameters(parameter_file.read()) + + ## Fluid-Structure model parts definition + self.structure_main_model_part = ModelPart(self.ProjectParameters["structure_solver_settings"]["problem_data"]["model_part_name"].GetString()) + self.structure_main_model_part.ProcessInfo.SetValue(DOMAIN_SIZE, self.ProjectParameters["structure_solver_settings"]["problem_data"]["domain_size"].GetInt()) + + self.fluid_main_model_part = ModelPart(self.ProjectParameters["fluid_solver_settings"]["problem_data"]["model_part_name"].GetString()) + self.fluid_main_model_part.ProcessInfo.SetValue(DOMAIN_SIZE, self.ProjectParameters["fluid_solver_settings"]["problem_data"]["domain_size"].GetInt()) + + FluidModel = {self.ProjectParameters["fluid_solver_settings"]["problem_data"]["model_part_name"].GetString() : self.fluid_main_model_part} + SolidModel = {self.ProjectParameters["structure_solver_settings"]["problem_data"]["model_part_name"].GetString() : self.structure_main_model_part} + + ## Solver construction + solver_module = __import__(self.ProjectParameters["coupling_solver_settings"]["solver_settings"]["solver_type"].GetString()) + self.solver = solver_module.CreateSolver(self.structure_main_model_part, self.fluid_main_model_part, self.ProjectParameters) + + self.solver.AddVariables() + + ## Read the model - note that SetBufferSize is done here + self.solver.ImportModelPart() + + ## Add AddDofs + self.solver.AddDofs() + + ## Initialize GiD I/O + if (self.print_output == True): + from gid_output_process import GiDOutputProcess + + self.gid_output_structure = GiDOutputProcess(self.solver.structure_solver.GetComputingModelPart(), + self.ProjectParameters["structure_solver_settings"]["problem_data"]["problem_name"].GetString()+"_structure", + self.ProjectParameters["structure_solver_settings"]["output_configuration"]) + + self.gid_output_fluid = GiDOutputProcess(self.solver.fluid_solver.GetComputingModelPart(), + self.ProjectParameters["fluid_solver_settings"]["problem_data"]["problem_name"].GetString()+"_fluid", + self.ProjectParameters["fluid_solver_settings"]["output_configuration"]) + + self.gid_output_structure.ExecuteInitialize() + self.gid_output_fluid.ExecuteInitialize() + + ## Get the list of the skin submodel parts in the object Model (FLUID) + for i in range(self.ProjectParameters["fluid_solver_settings"]["solver_settings"]["skin_parts"].size()): + skin_part_name = self.ProjectParameters["fluid_solver_settings"]["solver_settings"]["skin_parts"][i].GetString() + FluidModel.update({skin_part_name: self.fluid_main_model_part.GetSubModelPart(skin_part_name)}) + + ## Get the list of the no-skin submodel parts in the object Model (FLUID) + for i in range(self.ProjectParameters["fluid_solver_settings"]["solver_settings"]["no_skin_parts"].size()): + no_skin_part_name = self.ProjectParameters["fluid_solver_settings"]["solver_settings"]["no_skin_parts"][i].GetString() + FluidModel.update({no_skin_part_name: self.fluid_main_model_part.GetSubModelPart(no_skin_part_name)}) + + ## Get the list of the initial conditions submodel parts in the object Model (FLUID) + for i in range(self.ProjectParameters["fluid_solver_settings"]["initial_conditions_process_list"].size()): + initial_cond_part_name = self.ProjectParameters["fluid_solver_settings"]["initial_conditions_process_list"][i]["Parameters"]["model_part_name"].GetString() + FluidModel.update({initial_cond_part_name: self.fluid_main_model_part.GetSubModelPart(initial_cond_part_name)}) + + ## Get the gravity submodel part in the object Model (FLUID) + for i in range(self.ProjectParameters["fluid_solver_settings"]["gravity"].size()): + gravity_part_name = self.ProjectParameters["fluid_solver_settings"]["gravity"][i]["Parameters"]["model_part_name"].GetString() + FluidModel.update({gravity_part_name: self.fluid_main_model_part.GetSubModelPart(gravity_part_name)}) + + ## Get the list of the submodel part in the object Model (STRUCTURE) + for i in range(self.ProjectParameters["structure_solver_settings"]["solver_settings"]["processes_sub_model_part_list"].size()): + part_name = self.ProjectParameters["structure_solver_settings"]["solver_settings"]["processes_sub_model_part_list"][i].GetString() + SolidModel.update({part_name: self.structure_main_model_part.GetSubModelPart(part_name)}) + + ## Processes construction + import process_factory + # "list_of_processes" contains all the processes already constructed (boundary conditions, initial conditions and gravity) + # Note that the conditions are firstly constructed. Otherwise, they may overwrite the BCs information. + + # FLUID DOMAIN PROCESSES + self.list_of_processes = process_factory.KratosProcessFactory(FluidModel).ConstructListOfProcesses( self.ProjectParameters["fluid_solver_settings"]["initial_conditions_process_list"] ) + self.list_of_processes += process_factory.KratosProcessFactory(FluidModel).ConstructListOfProcesses( self.ProjectParameters["fluid_solver_settings"]["boundary_conditions_process_list"] ) + self.list_of_processes += process_factory.KratosProcessFactory(FluidModel).ConstructListOfProcesses( self.ProjectParameters["fluid_solver_settings"]["gravity"] ) + + # SOLID DOMAIN PROCESSES + self.list_of_processes += process_factory.KratosProcessFactory(SolidModel).ConstructListOfProcesses( self.ProjectParameters["structure_solver_settings"]["constraints_process_list"] ) + self.list_of_processes += process_factory.KratosProcessFactory(SolidModel).ConstructListOfProcesses( self.ProjectParameters["structure_solver_settings"]["loads_process_list"] ) + + ## Processes initialization + for process in self.list_of_processes: + process.ExecuteInitialize() + + # Solver initialization moved after the processes initialization, otherwise the flag INTERFACE is not set + self.solver.Initialize() + + ## Time settings + end_time = self.ProjectParameters["fluid_solver_settings"]["problem_data"]["end_time"].GetDouble() + time = 0.0 + step = 0 + out = 0.0 + + if (self.print_output == True): + self.gid_output_structure.ExecuteBeforeSolutionLoop() + self.gid_output_fluid.ExecuteBeforeSolutionLoop() + + for process in self.list_of_processes: + process.ExecuteBeforeSolutionLoop() + + while(time <= end_time): + + Dt = (self.solver).ComputeDeltaTime() + time = time + Dt + step = step + 1 + + self.solver.SetTimeStep(step) + + self.structure_main_model_part.CloneTimeStep(time) + self.fluid_main_model_part.CloneTimeStep(time) + + for process in self.list_of_processes: + process.ExecuteInitializeSolutionStep() + + if (self.print_output == True): + self.gid_output_structure.ExecuteInitializeSolutionStep() + self.gid_output_fluid.ExecuteInitializeSolutionStep() + + (self.solver).Solve() + + for process in self.list_of_processes: + process.ExecuteFinalizeSolutionStep() + + if (self.print_output == True): + self.gid_output_structure.ExecuteFinalizeSolutionStep() + self.gid_output_fluid.ExecuteFinalizeSolutionStep() + + #TODO: decide if it shall be done only when output is processed or not + for process in self.list_of_processes: + process.ExecuteBeforeOutputStep() + + if (self.print_output == True): + if self.gid_output_structure.IsOutputStep(): + self.gid_output_structure.PrintOutput() + if self.gid_output_fluid.IsOutputStep(): + self.gid_output_fluid.PrintOutput() + + for process in self.list_of_processes: + process.ExecuteAfterOutputStep() + + out = out + Dt + + for process in self.list_of_processes: + process.ExecuteFinalize() + + if (self.print_output == True): + self.gid_output_structure.ExecuteFinalize() + self.gid_output_fluid.ExecuteFinalize() + + +if __name__ == '__main__': + test = MokBenchmarkTest() + test.setUp() + test.print_output = True + test.testMokBenchmark() + test.tearDown() diff --git a/applications/FSIapplication/tests/non_conformant_one_side_map_test.py b/applications/FSIapplication/tests/non_conformant_one_side_map_test.py new file mode 100644 index 000000000000..355e23c5b78b --- /dev/null +++ b/applications/FSIapplication/tests/non_conformant_one_side_map_test.py @@ -0,0 +1,541 @@ +from KratosMultiphysics import * +from KratosMultiphysics.FSIApplication import * + +import KratosMultiphysics.KratosUnittest as UnitTest + +from os import remove + +try: + from KratosMultiphysics.StructuralMechanicsApplication import * + from KratosMultiphysics.FluidDynamicsApplication import * + missing_external_dependencies = False + missing_application = '' +except ImportError as e: + missing_external_dependencies = True + # extract name of the missing application from the error message + import re + missing_application = re.search(r'''.*'KratosMultiphysics\.(.*)'.*''','{0}'.format(e)).group(1) + +import NonConformant_OneSideMap + +class WorkFolderScope: + def __init__(self, work_folder): + self.currentPath = os.getcwd() + self.scope = os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__)),work_folder)) + + def __enter__(self): + os.chdir(self.scope) + + def __exit__(self, type, value, traceback): + os.chdir(self.currentPath) + +class NonConformantOneSideMapTest(UnitTest.TestCase): + + def setUp(self): + # Test case settings + self.domain_size = None + self.fluid_input_file = None + self.solid_input_file = None + self.work_folder = "NonConformantOneSideMapTest" + + # Mapper settings + self.search_radius_factor = 2.0 + self.mapper_max_iterations = 200 + self.mapper_tolerance = 1e-12 + + # Testing settings + self.check_tolerance = None + self.print_output = False + + def tearDown(self): + self.deleteOutFile(self.fluid_input_file+'.time') + self.deleteOutFile(self.solid_input_file+'.time') + + def deleteOutFile(self,filename): + with WorkFolderScope(self.work_folder): + try: + remove(filename) + except FileNotFoundError as e: + pass + + def test2D_1(self): + self.domain_size = 2 + + self.fluid_input_file = "2D_fluid_mesh_test1" + self.solid_input_file = "2D_solid_mesh_test1" + + self.fluid_interface_name = "Fluid_interface" + self.solid_interface_name = "Solid_interface" + + self.check_tolerance = 0.1 + + def SetFluidData(): + fluid_interface = self.GetFluidInterfaceModelPart() + + # Constant pressure distribution + for node in fluid_interface.Nodes: + node.SetSolutionStepValue(PRESSURE, 0, 2.0) + + # Linear x-reaction distribution + fluid_interface.Nodes[1].SetSolutionStepValue(REACTION_X, 0, 2.0) + fluid_interface.Nodes[3].SetSolutionStepValue(REACTION_X, 0, 4.7) + fluid_interface.Nodes[5].SetSolutionStepValue(REACTION_X, 0, 5.6) + fluid_interface.Nodes[7].SetSolutionStepValue(REACTION_X, 0, 6.6) + fluid_interface.Nodes[9].SetSolutionStepValue(REACTION_X, 0, 3.6) + + # Linear y-reaction distribution + fluid_interface.Nodes[1].SetSolutionStepValue(REACTION_Y, 0, 3.6) + fluid_interface.Nodes[3].SetSolutionStepValue(REACTION_Y, 0, 6.6) + fluid_interface.Nodes[5].SetSolutionStepValue(REACTION_Y, 0, 5.6) + fluid_interface.Nodes[7].SetSolutionStepValue(REACTION_Y, 0, 4.7) + fluid_interface.Nodes[9].SetSolutionStepValue(REACTION_Y, 0, 2.0) + + def SetSolidData(): + solid_interface = self.GetSolidInterfaceModelPart() + + # Parabolic velocity distribution + for node in solid_interface.Nodes: + node.SetSolutionStepValue(VELOCITY_X, 0, 2*node.Y - node.Y*node.Y/2.0) + node.SetSolutionStepValue(VELOCITY_Y, 0, 2*node.Y - node.Y*node.Y/2.0) + node.SetSolutionStepValue(VELOCITY_Z, 0, 0.0) + + def CheckFluidResults(): + fluid_interface = self.GetFluidInterfaceModelPart() + + # Mapped VELOCITY check + for node in fluid_interface.Nodes: + obtained_velocity_value = node.GetSolutionStepValue(VELOCITY,0) + expected_velocity_value = [2*node.Y-node.Y*node.Y/2.0, 2*node.Y-node.Y*node.Y/2.0, 0.0] + for i in range(0,3): + self.assertAlmostEqual(obtained_velocity_value[i], expected_velocity_value[i], delta=self.check_tolerance) + + def CheckSolidResults(): + solid_interface = self.GetSolidInterfaceModelPart() + + # Mapped PRESSURE check + for node in solid_interface.Nodes: + obtained_pressure_value = node.GetSolutionStepValue(PRESSURE,0) + expected_pressure_value = 2.0 + self.assertAlmostEqual(obtained_pressure_value, expected_pressure_value) + + # Force equilibrium check (mapped POINT_LOAD) + expected_sum_fx = 22.5 + expected_sum_fy = 22.5 + expected_sum_fz = 0.0 + + obtained_sum_fx = 0.0 + obtained_sum_fy = 0.0 + obtained_sum_fz = 0.0 + + for node in solid_interface.Nodes: + f_solid = node.GetSolutionStepValue(POINT_LOAD) + obtained_sum_fx += f_solid[0] + obtained_sum_fy += f_solid[1] + obtained_sum_fz += f_solid[2] + + self.assertAlmostEqual(obtained_sum_fx, expected_sum_fx, delta=self.check_tolerance) + self.assertAlmostEqual(obtained_sum_fy, expected_sum_fy, delta=self.check_tolerance) + self.assertAlmostEqual(obtained_sum_fz, expected_sum_fz, delta=self.check_tolerance) + + # Run test + self.RunTestCase(SetFluidData, SetSolidData, CheckFluidResults, CheckSolidResults) + + def test2D_2(self): + self.domain_size = 2 + + self.fluid_input_file = "2D_fluid_mesh_test2" + self.solid_input_file = "2D_solid_mesh_test2" + + self.fluid_interface_name = "Fluid_interface" + self.solid_interface_name = "Solid_interface" + + self.check_tolerance = 0.1 + + def SetFluidData(): + fluid_interface = self.GetFluidInterfaceModelPart() + + for node in fluid_interface.Nodes: + node.SetSolutionStepValue(PRESSURE, 0, node.Y*20) # Linear PRESSURE variation + node.SetSolutionStepValue(REACTION_X, 0, node.Y*30) # Linear REACTION_X variation + node.SetSolutionStepValue(REACTION_Y, 0, node.Y*node.Y*200) # Parabolic REACTION_Y variation + + def SetSolidData(): + solid_interface = self.GetSolidInterfaceModelPart() + + for node in solid_interface.Nodes: + node.SetSolutionStepValue(VELOCITY_X, 0, node.Y*10) # Linear VELOCITY_X distribution + node.SetSolutionStepValue(VELOCITY_Y, 0, node.Y*node.Y*10000) # Parabolic VELOCITY_Y distribution + node.SetSolutionStepValue(VELOCITY_Z, 0, 0.0) + + def CheckFluidResults(): + fluid_interface = self.GetFluidInterfaceModelPart() + + # Mapped VELOCITY check + for node in fluid_interface.Nodes: + obtained_velocity_value = node.GetSolutionStepValue(VELOCITY,0) + expected_velocity_value = [node.Y*10, node.Y*node.Y*10000, 0.0] + for i in range(0,3): + self.assertAlmostEqual(obtained_velocity_value[i], expected_velocity_value[i], delta=0.15) + + def CheckSolidResults(): + solid_interface = self.GetSolidInterfaceModelPart() + + # Mapped PRESSURE check + for node in solid_interface.Nodes: + obtained_pressure_value = node.GetSolutionStepValue(PRESSURE,0) + expected_pressure_value = node.Y*20 + self.assertAlmostEqual(obtained_pressure_value, expected_pressure_value, delta=self.check_tolerance) + + # Force equilibrium check (mapped POINT_LOAD) + expected_sum_fx = 765.0 + expected_sum_fy = 858.375 + expected_sum_fz = 0.0 + + obtained_sum_fx = 0.0 + obtained_sum_fy = 0.0 + obtained_sum_fz = 0.0 + + for node in solid_interface.Nodes: + f_solid = node.GetSolutionStepValue(POINT_LOAD) + obtained_sum_fx += f_solid[0] + obtained_sum_fy += f_solid[1] + obtained_sum_fz += f_solid[2] + + self.assertAlmostEqual(obtained_sum_fx, expected_sum_fx, delta=self.check_tolerance) + self.assertAlmostEqual(obtained_sum_fy, expected_sum_fy, delta=self.check_tolerance) + self.assertAlmostEqual(obtained_sum_fz, expected_sum_fz, delta=self.check_tolerance) + + # Run test + self.RunTestCase(SetFluidData, SetSolidData, CheckFluidResults, CheckSolidResults) + + def test3D_1(self): + self.domain_size = 3 + + self.fluid_input_file = "3D_fluid_mesh_test1" + self.solid_input_file = "3D_solid_mesh_test1" + + self.fluid_interface_name = "Fluid_interface" + self.solid_interface_name = "Solid_interface" + + self.check_tolerance = 5e-3 + + def SetFluidData(): + fluid_interface = self.GetFluidInterfaceModelPart() + + # Linear pressure distribution + for node in fluid_interface.Nodes: + node.SetSolutionStepValue(PRESSURE, 0, node.X*node.Y*node.Z) + + # Linear reaction distribution + for node in fluid_interface.Nodes: + node.SetSolutionStepValue(REACTION_X, 0, node.Y) + node.SetSolutionStepValue(REACTION_Y, 0, 2*node.Z) + node.SetSolutionStepValue(REACTION_Z, 0, 3*node.X) + + def SetSolidData(): + solid_interface = self.GetSolidInterfaceModelPart() + + # Parabolic velocity distribution + for node in solid_interface.Nodes: + node.SetSolutionStepValue(VELOCITY_X, 0, -(2*node.Z - node.Y*node.Z/2.0)) + node.SetSolutionStepValue(VELOCITY_Y, 0, 2*node.Z - node.Y*node.Z/2.0) + node.SetSolutionStepValue(VELOCITY_Z, 0, node.X*node.Y) + + def CheckFluidResults(): + fluid_interface = self.GetFluidInterfaceModelPart() + + # Mapped VELOCITY check + for node in fluid_interface.Nodes: + obtained_velocity_value = node.GetSolutionStepValue(VELOCITY,0) + expected_velocity_value = [-(2*node.Z-node.Y*node.Z/2.0) , 2*node.Z-node.Y*node.Z/2.0, node.X*node.Y] + for i in range(0,3): + self.assertAlmostEqual(obtained_velocity_value[i], expected_velocity_value[i], delta=self.check_tolerance) + + def CheckSolidResults(): + solid_interface = self.GetSolidInterfaceModelPart() + + # Mapped PRESSURE check + for node in solid_interface.Nodes: + obtained_pressure_value = node.GetSolutionStepValue(PRESSURE,0) + expected_pressure_value = node.X*node.Y*node.Z + self.assertAlmostEqual(obtained_pressure_value, expected_pressure_value, delta=self.check_tolerance) + + # Force equilibrium check (mapped POINT_LOAD) + expected_sum_fx = 69.54492675560007 + expected_sum_fy = 187.00000000000003 + expected_sum_fz = 352.3652168853 + + obtained_sum_fx = 0.0 + obtained_sum_fy = 0.0 + obtained_sum_fz = 0.0 + + for node in solid_interface.Nodes: + f_solid = node.GetSolutionStepValue(POINT_LOAD) + obtained_sum_fx += f_solid[0] + obtained_sum_fy += f_solid[1] + obtained_sum_fz += f_solid[2] + + self.assertAlmostEqual(obtained_sum_fx, expected_sum_fx, delta=2.5) + self.assertAlmostEqual(obtained_sum_fy, expected_sum_fy, delta=5.0) + self.assertAlmostEqual(obtained_sum_fz, expected_sum_fz, delta=10.0) + + # Run test + self.RunTestCase(SetFluidData, SetSolidData, CheckFluidResults, CheckSolidResults) + + def test3D_two_faces(self): + self.domain_size = 3 + + self.fluid_input_file = "3D_fluid_mesh_two_faces_test" + self.solid_input_file = "3D_solid_mesh_two_faces_test" + + self.fluid_positive_interface_name = "Fluid_interface_pos" + self.fluid_negative_interface_name = "Fluid_interface_neg" + self.solid_interface_name = "Solid_interface" + + self.check_tolerance = 5e-3 + + def SetFluidData(): + positive_interface_model_part = self.fluid_main_model_part.GetSubModelPart(self.fluid_positive_interface_name) + negative_interface_model_part = self.fluid_main_model_part.GetSubModelPart(self.fluid_negative_interface_name) + + # Assign the PRESSURE values + for node_pos, node_neg in zip(positive_interface_model_part.Nodes, negative_interface_model_part.Nodes): + if (node_neg.Id == node_pos.Id): + node_pos.SetSolutionStepValue(PRESSURE, 0, 0.0) # If the node is shared, set a unique value + else: + node_pos.SetSolutionStepValue(PRESSURE, 0, -(-36.07*node_pos.Y*node_pos.Y+36.04*node_pos.Y-8)*(8*node_pos.Z-16*node_pos.Z*node_pos.Z)) # Positive face nodal values + node_neg.SetSolutionStepValue(PRESSURE, 0, (-36.07*node_neg.Y*node_neg.Y+36.04*node_neg.Y-8)*(8*node_neg.Z-16*node_neg.Z*node_neg.Z)) # Negative face nodal values + + def SetSolidData(): + solid_interface = self.GetSolidInterfaceModelPart() + + # Parabolic velocity distribution + for node in solid_interface.Nodes: + node.SetSolutionStepValue(VELOCITY_X, 0, -(2*node.Z - node.Y*node.Z/2.0)) + node.SetSolutionStepValue(VELOCITY_Y, 0, 2*node.Z - node.Y*node.Z/2.0) + node.SetSolutionStepValue(VELOCITY_Z, 0, node.X*node.Y) + + def CheckFluidResults(): + positive_interface_model_part = self.fluid_main_model_part.GetSubModelPart(self.fluid_positive_interface_name) + negative_interface_model_part = self.fluid_main_model_part.GetSubModelPart(self.fluid_negative_interface_name) + + # Mapped VELOCITY check in positive interface + for node in positive_interface_model_part.Nodes: + obtained_velocity_value = node.GetSolutionStepValue(VELOCITY,0) + expected_velocity_value = [-(2*node.Z-node.Y*node.Z/2.0) , 2*node.Z-node.Y*node.Z/2.0, node.X*node.Y] + for i in range(0,3): + self.assertAlmostEqual(obtained_velocity_value[i], expected_velocity_value[i], delta=self.check_tolerance) + + # Mapped VELOCITY check in negative interface + for node in negative_interface_model_part.Nodes: + obtained_velocity_value = node.GetSolutionStepValue(VELOCITY,0) + expected_velocity_value = [-(2*node.Z-node.Y*node.Z/2.0) , 2*node.Z-node.Y*node.Z/2.0, node.X*node.Y] + for i in range(0,3): + self.assertAlmostEqual(obtained_velocity_value[i], expected_velocity_value[i], delta=self.check_tolerance) + + def CheckSolidResults(): + solid_interface = self.GetSolidInterfaceModelPart() + + # Mapped PRESSURE check + for node in solid_interface.Nodes: + obtained_pressure_value = node.GetSolutionStepValue(POSITIVE_FACE_PRESSURE,0) + expected_pressure_value = -(-36.07*node.Y*node.Y+36.04*node.Y-8)*(8*node.Z-16*node.Z*node.Z) + self.assertAlmostEqual(obtained_pressure_value, expected_pressure_value, delta=2.5e-2) + + for node in solid_interface.Nodes: + obtained_pressure_value = node.GetSolutionStepValue(NEGATIVE_FACE_PRESSURE,0) + expected_pressure_value = (-36.07*node.Y*node.Y+36.04*node.Y-8)*(8*node.Z-16*node.Z*node.Z) + self.assertAlmostEqual(obtained_pressure_value, expected_pressure_value, delta=2.5e-2) + + # Run test + self.RunTwoFacesTestCase(SetFluidData, SetSolidData, CheckFluidResults, CheckSolidResults) + + def RunTestCase(self, set_fluid_data, set_solid_data, check_fluid_results, check_solid_results): + with WorkFolderScope(self.work_folder): + # Problem set up + self.SetUpProblem() + + # Set the interface flag in the fluid and solid interfaces + self.GenerateInterface() + + # Construct the mapper object + self.mapper = NonConformant_OneSideMap.NonConformant_OneSideMap(self.fluid_main_model_part, + self.solid_main_model_part, + self.search_radius_factor, + self.mapper_max_iterations, + self.mapper_tolerance) + + # Set the data to be mapped + set_fluid_data() + set_solid_data() + + # Map information between fluid and solid domains + self.PerformMapping() + + # If required, print output + if self.print_output: + self.InitializeOutput() + self.PrintOutput() + self.FinalizeOutput() + + # Check the mapped results + check_fluid_results() + check_solid_results() + + def RunTwoFacesTestCase(self, set_fluid_data, set_solid_data, check_fluid_results, check_solid_results): + with WorkFolderScope(self.work_folder): + # Problem set up + self.SetUpProblem() + + # Set the interface flag in the fluid and solid interfaces + self.GenerateTwoFacesInterface() + + # Construct the mapper object + self.mapper = NonConformant_OneSideMap.NonConformantTwoFaces_OneSideMap(self.fluid_main_model_part.GetSubModelPart(self.fluid_positive_interface_name), + self.fluid_main_model_part.GetSubModelPart(self.fluid_negative_interface_name), + self.solid_main_model_part.GetSubModelPart(self.solid_interface_name), + self.search_radius_factor, + self.mapper_max_iterations, + self.mapper_tolerance) + + # Set the data to be mapped + set_fluid_data() + set_solid_data() + + # Map information between fluid and solid domains + self.PerformTwoFacesMapping() + + # If required, print output + if self.print_output: + self.InitializeOutput() + self.PrintOutput() + self.FinalizeOutput() + + # Check the mapped results + check_fluid_results() + check_solid_results() + + def SetUpProblem(self): + # Defining a model part for the fluid and one for the structure + self.fluid_main_model_part = ModelPart("fluid_part") + self.solid_main_model_part = ModelPart("solid_part") + + # Set the domain size (2D or 3D test) + self.solid_main_model_part.ProcessInfo.SetValue(DOMAIN_SIZE, self.domain_size) + self.fluid_main_model_part.ProcessInfo.SetValue(DOMAIN_SIZE, self.domain_size) + + # Fluid model part variables addition + self.fluid_main_model_part.AddNodalSolutionStepVariable(VELOCITY) + self.fluid_main_model_part.AddNodalSolutionStepVariable(PRESSURE) + self.fluid_main_model_part.AddNodalSolutionStepVariable(REACTION) + self.fluid_main_model_part.AddNodalSolutionStepVariable(MAPPER_SCALAR_PROJECTION_RHS) + self.fluid_main_model_part.AddNodalSolutionStepVariable(MAPPER_VECTOR_PROJECTION_RHS) + self.fluid_main_model_part.AddNodalSolutionStepVariable(VAUX_EQ_TRACTION) + self.fluid_main_model_part.AddNodalSolutionStepVariable(NORMAL) + self.fluid_main_model_part.AddNodalSolutionStepVariable(NODAL_MAUX) + self.fluid_main_model_part.AddNodalSolutionStepVariable(SCALAR_PROJECTED) + self.fluid_main_model_part.AddNodalSolutionStepVariable(VECTOR_PROJECTED) + + # Structure model part variables addition + self.solid_main_model_part.AddNodalSolutionStepVariable(VELOCITY) + self.solid_main_model_part.AddNodalSolutionStepVariable(PRESSURE) + self.solid_main_model_part.AddNodalSolutionStepVariable(POINT_LOAD) + self.solid_main_model_part.AddNodalSolutionStepVariable(POSITIVE_FACE_PRESSURE) + self.solid_main_model_part.AddNodalSolutionStepVariable(NEGATIVE_FACE_PRESSURE) + self.solid_main_model_part.AddNodalSolutionStepVariable(MAPPER_SCALAR_PROJECTION_RHS) + self.solid_main_model_part.AddNodalSolutionStepVariable(MAPPER_VECTOR_PROJECTION_RHS) + self.solid_main_model_part.AddNodalSolutionStepVariable(VAUX_EQ_TRACTION) + self.solid_main_model_part.AddNodalSolutionStepVariable(NORMAL) + self.solid_main_model_part.AddNodalSolutionStepVariable(NODAL_MAUX) + self.solid_main_model_part.AddNodalSolutionStepVariable(SCALAR_PROJECTED) + self.solid_main_model_part.AddNodalSolutionStepVariable(VECTOR_PROJECTED) + + # Model parts reading + ModelPartIO(self.fluid_input_file).ReadModelPart(self.fluid_main_model_part) + ModelPartIO(self.solid_input_file).ReadModelPart(self.solid_main_model_part) + + # Buffer size set + self.fluid_main_model_part.SetBufferSize(1) + self.solid_main_model_part.SetBufferSize(1) + + def GenerateInterface(self): + # Set fluid and structure interfaces + for node in self.fluid_main_model_part.GetSubModelPart(self.fluid_interface_name).Nodes: + node.Set(INTERFACE, True) + for node in self.solid_main_model_part.GetSubModelPart(self.solid_interface_name).Nodes: + node.Set(INTERFACE, True) + + def GenerateTwoFacesInterface(self): + # Set fluid and structure interfaces + for node in self.fluid_main_model_part.GetSubModelPart(self.fluid_positive_interface_name).Nodes: + node.Set(INTERFACE, True) + for node in self.fluid_main_model_part.GetSubModelPart(self.fluid_negative_interface_name).Nodes: + node.Set(INTERFACE, True) + for node in self.solid_main_model_part.GetSubModelPart(self.solid_interface_name).Nodes: + node.Set(INTERFACE, True) + + def PerformMapping(self): + self.mapper.FluidToStructure_ScalarMap(PRESSURE, PRESSURE, True) + self.mapper.FluidToStructure_VectorMap(REACTION, POINT_LOAD, True, True) + self.mapper.StructureToFluid_VectorMap(VELOCITY, VELOCITY, True, False) + + def PerformTwoFacesMapping(self): + self.mapper.PositiveFluidToStructure_ScalarMap(PRESSURE, POSITIVE_FACE_PRESSURE, True) + self.mapper.NegativeFluidToStructure_ScalarMap(PRESSURE, NEGATIVE_FACE_PRESSURE, True) + self.mapper.StructureToPositiveFluid_VectorMap(VELOCITY, VELOCITY, True, False) + self.mapper.StructureToNegativeFluid_VectorMap(VELOCITY, VELOCITY, True, False) + + def GetFluidInterfaceModelPart(self): + return self.fluid_main_model_part.GetSubModelPart(self.fluid_interface_name) + + def GetSolidInterfaceModelPart(self): + return self.solid_main_model_part.GetSubModelPart(self.solid_interface_name) + + def InitializeOutput(self): + gid_mode = GiDPostMode.GiD_PostBinary + multifile = MultiFileFlag.SingleFile + deformed_mesh_flag = WriteDeformedMeshFlag.WriteDeformed + write_conditions = WriteConditionsFlag.WriteConditions + mesh_name = 0.0 + + self.fluid_gid_io = GidIO(self.fluid_input_file, gid_mode, multifile, deformed_mesh_flag, write_conditions) + self.fluid_gid_io.InitializeMesh( mesh_name) + self.fluid_gid_io.WriteMesh( self.fluid_main_model_part.GetMesh() ) + self.fluid_gid_io.FinalizeMesh() + self.fluid_gid_io.InitializeResults(mesh_name,(self.fluid_main_model_part).GetMesh()) + + self.solid_gid_io = GidIO(self.solid_input_file, gid_mode, multifile, deformed_mesh_flag, write_conditions) + self.solid_gid_io.InitializeMesh( mesh_name) + self.solid_gid_io.WriteMesh( self.solid_main_model_part.GetMesh() ) + self.solid_gid_io.FinalizeMesh() + self.solid_gid_io.InitializeResults(mesh_name,(self.solid_main_model_part).GetMesh()) + + def FinalizeOutput(self): + self.fluid_gid_io.FinalizeResults() + self.solid_gid_io.FinalizeResults() + + def PrintOutput(self): + fluid_label = self.fluid_main_model_part.ProcessInfo[TIME] + solid_label = self.solid_main_model_part.ProcessInfo[TIME] + + self.fluid_gid_io.WriteNodalResults(VELOCITY, self.fluid_main_model_part.Nodes, fluid_label, 0) + self.fluid_gid_io.WriteNodalResults(PRESSURE, self.fluid_main_model_part.Nodes, fluid_label, 0) + self.fluid_gid_io.WriteNodalResults(REACTION, self.fluid_main_model_part.Nodes, fluid_label, 0) + self.fluid_gid_io.WriteNodalResults(NODAL_MAUX, self.fluid_main_model_part.Nodes, fluid_label, 0) + self.fluid_gid_io.WriteNodalResults(VAUX_EQ_TRACTION, self.fluid_main_model_part.Nodes, fluid_label, 0) + + self.solid_gid_io.WriteNodalResults(VELOCITY, self.solid_main_model_part.Nodes, solid_label, 0) + self.solid_gid_io.WriteNodalResults(PRESSURE, self.solid_main_model_part.Nodes, solid_label, 0) + self.solid_gid_io.WriteNodalResults(POINT_LOAD, self.solid_main_model_part.Nodes, solid_label, 0) + self.solid_gid_io.WriteNodalResults(NODAL_MAUX, self.solid_main_model_part.Nodes, solid_label, 0) + self.solid_gid_io.WriteNodalResults(VAUX_EQ_TRACTION, self.solid_main_model_part.Nodes, solid_label, 0) + +if __name__ == '__main__': + test = NonConformantOneSideMapTest() + test.setUp() + test.print_output = True + # test.test2D_1() + # test.test2D_2() + # test.test3D_1() + test.test3D_two_faces() + test.tearDown() diff --git a/applications/FSIapplication/tests/test_FSIApplication.py b/applications/FSIapplication/tests/test_FSIApplication.py index 79f742b36137..177af61761b9 100644 --- a/applications/FSIapplication/tests/test_FSIApplication.py +++ b/applications/FSIapplication/tests/test_FSIApplication.py @@ -7,18 +7,16 @@ # Import the tests o test_classes to create the suits ## SMALL TESTS -from SmallTests import FSIProblemEmulatorTest as TFSIProblemEmulatorTest -from SmallTests import NonConformantOneSideMap2D_test1 as TNonConformantOneSideMap2D_test1 -from SmallTests import NonConformantOneSideMap2D_test2 as TNonConformantOneSideMap2D_test2 -from SmallTests import NonConformantOneSideMap3D_test1 as TNonConformantOneSideMap3D_test1 -from SmallTests import NonConformantOneSideMapTwoFaces3D_test1 as TNonConformantOneSideMapTwoFaces3D_test1 -from KratosExecuteConvergenceAcceleratorTest import KratosExecuteConvergenceAcceleratorTest as TConvergenceAcceleratorTest +from convergence_accelerator_test import ConvergenceAcceleratorTest +from convergence_accelerator_spring_test import ConvergenceAcceleratorSpringTest +from FSI_problem_emulator_test import FSIProblemEmulatorTest +from non_conformant_one_side_map_test import NonConformantOneSideMapTest from variable_redistribution_test import VariableRedistributionTest ## NIGTHLY TESTS ## VALIDATION TESTS -from ValidationTests import MokBenchmarkTest as TMokBenchmark +from mok_benchmark_test import MokBenchmarkTest def AssembleTestSuites(): ''' Populates the test suites to run. @@ -36,15 +34,19 @@ def AssembleTestSuites(): # Create a test suit with the selected tests (Small tests): smallSuite = suites['small'] - smallSuite.addTest(TNonConformantOneSideMap2D_test1('test_execution')) - smallSuite.addTest(TNonConformantOneSideMap2D_test2('test_execution')) - smallSuite.addTest(TNonConformantOneSideMap3D_test1('test_execution')) - smallSuite.addTest(TNonConformantOneSideMapTwoFaces3D_test1('test_execution')) - smallSuite.addTest(TConvergenceAcceleratorTest('test_aitken_accelerator')) - smallSuite.addTest(TConvergenceAcceleratorTest('test_mvqn_accelerator')) - smallSuite.addTest(TConvergenceAcceleratorTest('test_mvqn_recusive_accelerator')) - smallSuite.addTest(TConvergenceAcceleratorTest('test_accelerator_with_jacobian')) - smallSuite.addTest(TFSIProblemEmulatorTest('test_execution')) + smallSuite.addTest(ConvergenceAcceleratorTest('test_aitken_accelerator')) + smallSuite.addTest(ConvergenceAcceleratorTest('test_mvqn_accelerator')) + smallSuite.addTest(ConvergenceAcceleratorTest('test_mvqn_recusive_accelerator')) + smallSuite.addTest(ConvergenceAcceleratorTest('test_accelerator_with_jacobian')) + smallSuite.addTest(FSIProblemEmulatorTest('testFSIProblemEmulatorWithAitken')) + smallSuite.addTest(FSIProblemEmulatorTest('testFSIProblemEmulatorWithMVQN')) + smallSuite.addTest(FSIProblemEmulatorTest('testFSIProblemEmulatorWithMVQNRecursive')) + smallSuite.addTest(ConvergenceAcceleratorSpringTest('test_aitken_accelerator_constant_forces')) + smallSuite.addTest(ConvergenceAcceleratorSpringTest('test_aitken_accelerator_variable_stiffness')) + smallSuite.addTest(NonConformantOneSideMapTest('test2D_1')) + smallSuite.addTest(NonConformantOneSideMapTest('test2D_2')) + smallSuite.addTest(NonConformantOneSideMapTest('test3D_1')) + smallSuite.addTest(NonConformantOneSideMapTest('test3D_two_faces')) smallSuite.addTest(VariableRedistributionTest('testLinearFunction')) smallSuite.addTest(VariableRedistributionTest('testSharpCorners')) smallSuite.addTest(VariableRedistributionTest('testVector')) @@ -57,7 +59,7 @@ def AssembleTestSuites(): # For very long tests that should not be in nighly and you can use to validate validationSuite = suites['validation'] - validationSuite.addTest(TMokBenchmark('test_execution')) + validationSuite.addTest(MokBenchmarkTest('testMokBenchmark')) # Create a test suit that contains all the tests allSuite = suites['all'] diff --git a/applications/FSIapplication/tests/test_mpi_FSIApplication.py b/applications/FSIapplication/tests/test_mpi_FSIApplication.py new file mode 100644 index 000000000000..cce3cf93f0e2 --- /dev/null +++ b/applications/FSIapplication/tests/test_mpi_FSIApplication.py @@ -0,0 +1,50 @@ +# import Kratos +from KratosMultiphysics import * +from KratosMultiphysics.FSIApplication import * + +# Import Kratos "wrapper" for unittests +import KratosMultiphysics.KratosUnittest as KratosUnittest + +# Import the tests o test_classes to create the suits +## SMALL TESTS +from convergence_accelerator_spring_MPI_test import ConvergenceAcceleratorSpringMPITest + +## NIGTHLY TESTS + +## VALIDATION TESTS + +def AssambleTestSuites(): + ''' Populates the test suites to run. + + Populates the test suites to run. At least, it should populate the suites: + "small", "nighlty" and "all" + + Return + ------ + + suites: A dictionary of suites + The set of suites with its test_cases added. + ''' + suites = KratosUnittest.KratosSuites + + ### Small MPI tests ######################################################## + smallMPISuite = suites['mpi_small'] + smallMPISuite.addTest(ConvergenceAcceleratorSpringMPITest('test_aitken_accelerator_constant_forces')) + smallMPISuite.addTest(ConvergenceAcceleratorSpringMPITest('test_aitken_accelerator_variable_stiffness')) + smallMPISuite.addTest(ConvergenceAcceleratorSpringMPITest('test_aitken_accelerator_ghost_nodes')) + + ### Nightly MPI tests ###################################################### + nightlyMPISuite = suites['mpi_nightly'] + nightlyMPISuite.addTests(smallMPISuite) + + ### Full MPI set ########################################################### + allMPISuite = suites['mpi_all'] + allMPISuite.addTests(nightlyMPISuite) + + allSuite = suites['all'] + allSuite.addTests(allMPISuite) + + return suites + +if __name__ == '__main__': + KratosUnittest.runTests( AssambleTestSuites() ) diff --git a/applications/trilinos_application/custom_python/add_custom_utilities_to_python.cpp b/applications/trilinos_application/custom_python/add_custom_utilities_to_python.cpp index 245530f1ea5a..97cab4408dda 100644 --- a/applications/trilinos_application/custom_python/add_custom_utilities_to_python.cpp +++ b/applications/trilinos_application/custom_python/add_custom_utilities_to_python.cpp @@ -1,50 +1,13 @@ -/* -============================================================================== -Kratos -A General Purpose Software for Multi-Physics Finite Element Analysis -Version 1.0 (Released on march 05, 2007). - -Copyright 2007 -Pooyan Dadvand, Riccardo Rossi -pooyan@cimne.upc.edu -rrossi@cimne.upc.edu -CIMNE (International Center for Numerical Methods in Engineering), -Gran Capita' s/n, 08034 Barcelona, Spain - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following condition: - -Distribution of this code for any commercial purpose is permissible -ONLY BY DIRECT ARRANGEMENT WITH THE COPYRIGHT OWNER. - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -============================================================================== -*/ - -// -// Project Name: Kratos -// Last modified by: $Author: janosch $ -// Date: $Date: 2008-04-28 16:19:49 $ -// Revision: $Revision: 1.2 $ +// | / | +// ' / __| _` | __| _ \ __| +// . \ | ( | | ( |\__ ` +// _|\_\_| \__,_|\__|\___/ ____/ +// Multi-Physics // +// License: BSD License +// Kratos default license: kratos/license.txt // - // System includes // External includes @@ -70,6 +33,10 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "custom_utilities/trilinos_fractional_step_settings_periodic.h" #include "custom_utilities/gather_modelpart_utility.h" #include "custom_utilities/mpi_normal_calculation_utilities.h" +#include "custom_utilities/trilinos_partitioned_fsi_utilities.h" + +// External includes +#include "FSIapplication/custom_utilities/aitken_convergence_accelerator.hpp" namespace Kratos { @@ -151,7 +118,7 @@ void AddCustomUtilitiesToPython() enum_("TrilinosTurbulenceModelLabel") .value("SpalartAllmaras",BaseSettingsType::SpalartAllmaras) ; - + typedef void (TrilinosFSSettingsType::*SetStrategyByParamsType)(TrilinosFSSettingsType::StrategyLabel const&,TrilinosLinearSolverType::Pointer,const double,const unsigned int); SetStrategyByParamsType ThisSetStrategyOverload = &TrilinosFSSettingsType::SetStrategy; @@ -174,8 +141,8 @@ void AddCustomUtilitiesToPython() .def("GetStrategy",&TrilinosFSSettingsPeriodicType::pGetStrategy) .def("SetEchoLevel",&TrilinosFSSettingsPeriodicType::SetEchoLevel) ; - - + + class_ ("GatherModelPartUtility", init() ) @@ -192,9 +159,54 @@ void AddCustomUtilitiesToPython() .def("CalculateOnSimplex",&MPINormalCalculationUtils::CalculateOnSimplex) ; + typedef TrilinosPartitionedFSIUtilities TrilinosPartitionedFSIUtilities2DType; + typedef TrilinosPartitionedFSIUtilities TrilinosPartitionedFSIUtilities3DType; + + class_< TrilinosPartitionedFSIUtilities2DType, boost::noncopyable > ("TrilinosPartitionedFSIUtilities2D", init < const Epetra_MpiComm& >()) + .def("GetInterfaceArea", &TrilinosPartitionedFSIUtilities2DType::GetInterfaceArea) + .def("GetInterfaceResidualSize", &TrilinosPartitionedFSIUtilities2DType::GetInterfaceResidualSize) + .def("SetUpInterfaceVector", &TrilinosPartitionedFSIUtilities2DType::SetUpInterfaceVector) + .def("ComputeInterfaceVectorResidual", &TrilinosPartitionedFSIUtilities2DType::ComputeInterfaceVectorResidual) + .def("UpdateInterfaceValues", &TrilinosPartitionedFSIUtilities2DType::UpdateInterfaceValues) + .def("ComputeFluidInterfaceMeshVelocityResidualNorm",&TrilinosPartitionedFSIUtilities2DType::ComputeFluidInterfaceMeshVelocityResidualNorm) + .def("ComputeAndPrintFluidInterfaceNorms", &TrilinosPartitionedFSIUtilities2DType::ComputeAndPrintFluidInterfaceNorms) + .def("ComputeAndPrintStructureInterfaceNorms", &TrilinosPartitionedFSIUtilities2DType::ComputeAndPrintStructureInterfaceNorms) + .def("CheckCurrentCoordinatesFluid", &TrilinosPartitionedFSIUtilities2DType::CheckCurrentCoordinatesFluid) + .def("CheckCurrentCoordinatesStructure", &TrilinosPartitionedFSIUtilities2DType::CheckCurrentCoordinatesStructure) + ; + + class_< TrilinosPartitionedFSIUtilities3DType, boost::noncopyable > ("TrilinosPartitionedFSIUtilities3D", init < const Epetra_MpiComm& >()) + .def("GetInterfaceArea", &TrilinosPartitionedFSIUtilities3DType::GetInterfaceArea) + .def("GetInterfaceResidualSize", &TrilinosPartitionedFSIUtilities3DType::GetInterfaceResidualSize) + .def("SetUpInterfaceVector", &TrilinosPartitionedFSIUtilities3DType::SetUpInterfaceVector) + .def("ComputeInterfaceVectorResidual", &TrilinosPartitionedFSIUtilities3DType::ComputeInterfaceVectorResidual) + .def("UpdateInterfaceValues", &TrilinosPartitionedFSIUtilities3DType::UpdateInterfaceValues) + .def("ComputeFluidInterfaceMeshVelocityResidualNorm",&TrilinosPartitionedFSIUtilities3DType::ComputeFluidInterfaceMeshVelocityResidualNorm) + .def("ComputeAndPrintFluidInterfaceNorms", &TrilinosPartitionedFSIUtilities3DType::ComputeAndPrintFluidInterfaceNorms) + .def("ComputeAndPrintStructureInterfaceNorms", &TrilinosPartitionedFSIUtilities3DType::ComputeAndPrintStructureInterfaceNorms) + .def("CheckCurrentCoordinatesFluid", &TrilinosPartitionedFSIUtilities3DType::CheckCurrentCoordinatesFluid) + .def("CheckCurrentCoordinatesStructure", &TrilinosPartitionedFSIUtilities3DType::CheckCurrentCoordinatesStructure) + ; + + + // Convergence accelerators (from FSIApplication) + typedef ConvergenceAccelerator TrilinosConvergenceAccelerator; + typedef AitkenConvergenceAccelerator TrilinosAitkenAccelerator; + + // Convergence accelerator base class + class_< TrilinosConvergenceAccelerator, boost::noncopyable > ("TrilinosConvergenceAccelerator", init < >()) + .def("Initialize", &TrilinosConvergenceAccelerator::Initialize) + .def("InitializeSolutionStep", &TrilinosConvergenceAccelerator::InitializeSolutionStep) + .def("InitializeNonLinearIteration", &TrilinosConvergenceAccelerator::InitializeNonLinearIteration) + .def("UpdateSolution", &TrilinosConvergenceAccelerator::UpdateSolution) + .def("FinalizeNonLinearIteration", &TrilinosConvergenceAccelerator::FinalizeNonLinearIteration) + .def("FinalizeSolutionStep", &TrilinosConvergenceAccelerator::FinalizeSolutionStep) + .def("SetEchoLevel", &TrilinosConvergenceAccelerator::SetEchoLevel) + ; + + class_< TrilinosAitkenAccelerator, bases, boost::noncopyable >("TrilinosAitkenConvergenceAccelerator",init()); } } // namespace Python. } // Namespace Kratos - diff --git a/applications/trilinos_application/custom_utilities/trilinos_partitioned_fsi_utilities.h b/applications/trilinos_application/custom_utilities/trilinos_partitioned_fsi_utilities.h new file mode 100644 index 000000000000..9d23d04272bd --- /dev/null +++ b/applications/trilinos_application/custom_utilities/trilinos_partitioned_fsi_utilities.h @@ -0,0 +1,248 @@ +// | / | +// ' / __| _` | __| _ \ __| +// . \ | ( | | ( |\__ ` +// _|\_\_| \__,_|\__|\___/ ____/ +// Multi-Physics +// +// License: BSD License +// Kratos default license: kratos/license.txt +// +// Main authors: Ruben Źorrilla +// Jordi Cotela +// + +#if !defined(KRATOS_TRILINOS_PARTITIONED_FSI_UTILITIES_H ) +#define KRATOS_TRILINOS_PARTITIONED_FSI_UTILITIES_H + + + +// System includes +#include +#include + + +// External includes +#include "Epetra_MpiComm.h" +#include "Epetra_Map.h" +#include "Epetra_Vector.h" + +// Project includes +#include "includes/define.h" + +#include "../FSIapplication/custom_utilities/partitioned_fsi_utilities.hpp" + +namespace Kratos +{ + ///@addtogroup TrilinosApplication + ///@{ + + ///@name Kratos Globals + ///@{ + + ///@} + ///@name Type Definitions + ///@{ + + ///@} + ///@name Enum's + ///@{ + + ///@} + ///@name Functions + ///@{ + + ///@} + ///@name Kratos Classes + ///@{ + + /// Trilinos version of the partitioned FSI tools + /** @see PartitionedFSIUtilities */ + template< class TSpace, unsigned int TDim > + class TrilinosPartitionedFSIUtilities : public PartitionedFSIUtilities + { + public: + ///@name Type Definitions + ///@{ + + /// Pointer definition of TrilinosPartitionedFSIUtilities + KRATOS_CLASS_POINTER_DEFINITION(TrilinosPartitionedFSIUtilities); + + typedef typename TSpace::VectorType VectorType; + typedef typename TSpace::MatrixType MatrixType; + + typedef typename TSpace::VectorPointerType VectorPointerType; + typedef typename TSpace::MatrixPointerType MatrixPointerType; + + ///@} + ///@name Life Cycle + ///@{ + + /// Default constructor. + TrilinosPartitionedFSIUtilities(const Epetra_MpiComm& EpetraCommunicator): + mrEpetraComm(EpetraCommunicator) + {} + + /// Destructor. + virtual ~TrilinosPartitionedFSIUtilities() override {} + + + ///@} + ///@name Operators + ///@{ + + + ///@} + ///@name Operations + ///@{ + + virtual void SetUpInterfaceVector(ModelPart& rInterfaceModelPart, + VectorPointerType& pInterfaceVector) override + { + // Initialize Epetra_Map for the vector + int NumLocalInterfaceDofs = rInterfaceModelPart.GetCommunicator().LocalMesh().NumberOfNodes() * TDim; + int NumGlobalInterfaceDofs = NumLocalInterfaceDofs; + rInterfaceModelPart.GetCommunicator().SumAll(NumGlobalInterfaceDofs); + int IndexBase = 0; // 0 for C-style vectors, 1 for Fortran numbering + Epetra_Map InterfaceMap(NumGlobalInterfaceDofs,NumLocalInterfaceDofs,IndexBase,mrEpetraComm); + + // Create new vector using given map + VectorPointerType Temp = VectorPointerType(new Epetra_FEVector(InterfaceMap)); + pInterfaceVector.swap(Temp); + + // Set interface vector to zero + pInterfaceVector->PutScalar(0.0); + } + + ///@} + ///@name Access + ///@{ + + + ///@} + ///@name Inquiry + ///@{ + + + ///@} + ///@name Input and output + ///@{ + + + ///@} + ///@name Friends + ///@{ + + + ///@} + + protected: + ///@name Protected static Member Variables + ///@{ + + + ///@} + ///@name Protected member Variables + ///@{ + + + ///@} + ///@name Protected Operators + ///@{ + + + ///@} + ///@name Protected Operations + ///@{ + + virtual void SetLocalValue(VectorType& rVector, int LocalRow, double Value) const override + { + // Note: We don't go through TSpace because TrilinosSpace forces a GlobalAssemble after each SetValue + rVector.ReplaceMyValue(LocalRow,0,Value); + } + + virtual double GetLocalValue(VectorType& rVector, int LocalRow) const override + { + return rVector[0][LocalRow]; + } + + + ///@} + ///@name Protected Access + ///@{ + + + ///@} + ///@name Protected Inquiry + ///@{ + + + ///@} + ///@name Protected LifeCycle + ///@{ + + + ///@} + + private: + ///@name Static Member Variables + ///@{ + + + ///@} + ///@name Member Variables + ///@{ + + const Epetra_MpiComm& mrEpetraComm; + + + ///@} + ///@name Private Operators + ///@{ + + + ///@} + ///@name Private Operations + ///@{ + + + ///@} + ///@name Private Access + ///@{ + + + ///@} + ///@name Private Inquiry + ///@{ + + + ///@} + ///@name Un accessible methods + ///@{ + + /// Assignment operator. + TrilinosPartitionedFSIUtilities& operator=(TrilinosPartitionedFSIUtilities const& rOther){} + + /// Copy constructor. + TrilinosPartitionedFSIUtilities(TrilinosPartitionedFSIUtilities const& rOther){} + + + ///@} + + }; // Class TrilinosPartitionedFSIUtilities + + ///@} + + ///@name Type Definitions + ///@{ + + + ///@} + ///@name Input and output + ///@{ + + + ///@} addtogroup block + +} // namespace Kratos. + +#endif // KRATOS_TRILINOS_PARTITIONED_FSI_UTILITIES_H defined diff --git a/applications/trilinos_application/trilinos_space.h b/applications/trilinos_application/trilinos_space.h index 102b4ef475b1..846502f5f46a 100644 --- a/applications/trilinos_application/trilinos_space.h +++ b/applications/trilinos_application/trilinos_space.h @@ -285,7 +285,7 @@ class TrilinosSpace // { // return inner_prod(row(rA, i), rX); // } - void SetValue(VectorType& rX, IndexType i, double value) + static void SetValue(VectorType& rX, IndexType i, double value) { Epetra_IntSerialDenseVector indices(1); Epetra_SerialDenseVector values(1); @@ -293,11 +293,10 @@ class TrilinosSpace values[0] = value; int ierr = rX.ReplaceGlobalValues(indices, values); - if(ierr != 0) KRATOS_THROW_ERROR(std::logic_error,"Epetra failure found",""); - - ierr = rX.GlobalAssemble(Insert,true); //Epetra_CombineMode mode=Add); - if (ierr < 0) KRATOS_THROW_ERROR(std::logic_error, "epetra failure when attempting to insert value in function SetValue", ""); + KRATOS_ERROR_IF(ierr != 0) << "Epetra failure found" << std::endl; + ierr = rX.GlobalAssemble(Insert,true); //Epetra_CombineMode mode=Add); + KRATOS_ERROR_IF(ierr < 0) << "Epetra failure when attempting to insert value in function SetValue" << std::endl; } /// rX = A @@ -317,7 +316,7 @@ class TrilinosSpace { KRATOS_THROW_ERROR(std::logic_error, "Resize is not defined for a reference to Trilinos Vector - need to use the version passing a Pointer", "") } - + static void Resize(VectorPointerType& pX, SizeType n) { // if(pX != NULL) @@ -546,29 +545,29 @@ class TrilinosSpace void ReadMatrixMarket(const std::string FileName, MatrixPointerType& pA) { KRATOS_TRY - + Epetra_CrsMatrix* pp = nullptr; int error_code = EpetraExt::MatrixMarketFileToCrsMatrix(FileName.c_str(), pA->Comm(), pp); - + if(error_code != 0) KRATOS_ERROR << "error thrown while reading Matrix Market file "<Graph(); MatrixPointerType paux = boost::make_shared( ::Copy, rGraph, false ); - + IndexType NumMyRows = rGraph.RowMap().NumMyElements(); int* MyGlobalElements = new int[NumMyRows]; rGraph.RowMap().MyGlobalElements(MyGlobalElements); - - + + for(IndexType i = 0; i < NumMyRows; ++i) { // std::cout << pA->Comm().MyPID() << " : I=" << i << std::endl; IndexType GlobalRow = MyGlobalElements[i]; - + int NumEntries; std::size_t Length = pp->NumGlobalEntries(GlobalRow); // length of Values and Indices @@ -576,25 +575,25 @@ class TrilinosSpace int* Indices = new int[Length]; // extracted global column indices for the corresponding values error_code = pp->ExtractGlobalRowCopy(GlobalRow, Length, NumEntries, Values, Indices); - + if(error_code != 0) KRATOS_ERROR << "error thrown in ExtractGlobalRowCopy : " << error_code; error_code = paux->ReplaceGlobalValues(GlobalRow, Length, Values, Indices); - + if(error_code != 0) KRATOS_ERROR << "error thrown in ReplaceGlobalValues : " << error_code; - + delete [] Values; delete [] Indices; } - + paux->GlobalAssemble(); pA.swap(paux); delete [] MyGlobalElements; // std::cout << pp << std::endl; delete pp; - + KRATOS_CATCH(""); } @@ -771,6 +770,4 @@ class TrilinosSpace } // namespace Kratos. -#endif // KRATOS_TRILINOS_SPACE_H_INCLUDED defined - - +#endif // KRATOS_TRILINOS_SPACE_H_INCLUDED defined diff --git a/kratos/CMakeLists.txt b/kratos/CMakeLists.txt index e411e61b45db..b9516f10eed3 100644 --- a/kratos/CMakeLists.txt +++ b/kratos/CMakeLists.txt @@ -16,6 +16,7 @@ set( KRATOS_CORE_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/sources/cfd_variables.cpp; ${CMAKE_CURRENT_SOURCE_DIR}/sources/ale_variables.cpp; ${CMAKE_CURRENT_SOURCE_DIR}/sources/dem_variables.cpp; + ${CMAKE_CURRENT_SOURCE_DIR}/sources/fsi_variables.cpp; ${CMAKE_CURRENT_SOURCE_DIR}/sources/mat_variables.cpp; ${CMAKE_CURRENT_SOURCE_DIR}/sources/legacy_structural_app_vars.cpp; ${CMAKE_CURRENT_SOURCE_DIR}/sources/variables.cpp; @@ -71,6 +72,7 @@ set( KRATOS_PYTHON_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/python/add_cfd_variables_to_python.cpp ${CMAKE_CURRENT_SOURCE_DIR}/python/add_ale_variables_to_python.cpp ${CMAKE_CURRENT_SOURCE_DIR}/python/add_dem_variables_to_python.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/python/add_fsi_variables_to_python.cpp ${CMAKE_CURRENT_SOURCE_DIR}/python/add_mat_variables_to_python.cpp ${CMAKE_CURRENT_SOURCE_DIR}/python/add_legacy_structural_app_vars_to_python.cpp ${CMAKE_CURRENT_SOURCE_DIR}/python/add_containers_to_python.cpp diff --git a/kratos/includes/ale_variables.h b/kratos/includes/ale_variables.h index b0064a042da7..002df9704e2f 100644 --- a/kratos/includes/ale_variables.h +++ b/kratos/includes/ale_variables.h @@ -35,6 +35,7 @@ namespace Kratos { KRATOS_DEFINE_3D_VARIABLE_WITH_COMPONENTS(MESH_DISPLACEMENT); + KRATOS_DEFINE_3D_VARIABLE_WITH_COMPONENTS(MESH_ACCELERATION); KRATOS_DEFINE_3D_VARIABLE_WITH_COMPONENTS(MESH_REACTION); KRATOS_DEFINE_3D_VARIABLE_WITH_COMPONENTS(MESH_RHS); diff --git a/kratos/includes/fsi_variables.h b/kratos/includes/fsi_variables.h new file mode 100644 index 000000000000..79c54bf788e2 --- /dev/null +++ b/kratos/includes/fsi_variables.h @@ -0,0 +1,65 @@ +// | / | +// ' / __| _` | __| _ \ __| +// . \ | ( | | ( |\__ \. +// _|\_\_| \__,_|\__|\___/ ____/ +// Multi-Physics +// +// License: BSD License +// Kratos default license: kratos/license.txt +// +// Main authors: Jordi Cotela +// Ruben Zorrilla +// + +#if !defined(KRATOS_FSI_VARIABLES_H_INCLUDED ) +#define KRATOS_FSI_VARIABLES_H_INCLUDED + + + +// System includes +#include +#include + +// External includes + + +// Project includes +#include "includes/define.h" +#include "containers/variable.h" +#include "containers/variable_component.h" +#include "containers/vector_component_adaptor.h" +#include "includes/kratos_components.h" +#include "includes/ublas_interface.h" +#include "containers/array_1d.h" +#include "containers/weak_pointer_vector.h" +#include "containers/periodic_variables_container.h" + +#undef KRATOS_EXPORT_MACRO +#define KRATOS_EXPORT_MACRO KRATOS_API + +//TODO: move to the FSI application +namespace Kratos +{ + // Variables definition + KRATOS_DEFINE_VARIABLE(int, CONVERGENCE_ACCELERATOR_ITERATION) + KRATOS_DEFINE_VARIABLE(double, MAPPER_SCALAR_PROJECTION_RHS) + KRATOS_DEFINE_VARIABLE(double, SCALAR_PROJECTED) + KRATOS_DEFINE_VARIABLE(double, FICTITIOUS_FLUID_DENSITY) + KRATOS_DEFINE_VARIABLE(double, FSI_INTERFACE_RESIDUAL_NORM) + KRATOS_DEFINE_VARIABLE(double, FSI_INTERFACE_MESH_RESIDUAL_NORM) + + KRATOS_DEFINE_3D_VARIABLE_WITH_COMPONENTS(MAPPER_VECTOR_PROJECTION_RHS) + KRATOS_DEFINE_3D_VARIABLE_WITH_COMPONENTS(VAUX_EQ_TRACTION) + KRATOS_DEFINE_3D_VARIABLE_WITH_COMPONENTS(VECTOR_PROJECTED) + KRATOS_DEFINE_3D_VARIABLE_WITH_COMPONENTS(RELAXED_DISP) + KRATOS_DEFINE_3D_VARIABLE_WITH_COMPONENTS(FSI_INTERFACE_RESIDUAL) + KRATOS_DEFINE_3D_VARIABLE_WITH_COMPONENTS(FSI_INTERFACE_MESH_RESIDUAL) + KRATOS_DEFINE_3D_VARIABLE_WITH_COMPONENTS(POSITIVE_MAPPED_VECTOR_VARIABLE) + KRATOS_DEFINE_3D_VARIABLE_WITH_COMPONENTS(NEGATIVE_MAPPED_VECTOR_VARIABLE) + +} // namespace Kratos + +#undef KRATOS_EXPORT_MACRO +#define KRATOS_EXPORT_MACRO KRATOS_NO_EXPORT + +#endif // KRATOS_FSI_VARIABLES_H_INCLUDED defined diff --git a/kratos/includes/kratos_application.h b/kratos/includes/kratos_application.h index 9ada52973254..f67a8bf520ee 100644 --- a/kratos/includes/kratos_application.h +++ b/kratos/includes/kratos_application.h @@ -89,13 +89,14 @@ class KRATOS_API(KRATOS_CORE) KratosApplication void RegisterVariables(); - + /////////////////////////////////////////////////////////////////// void RegisterDeprecatedVariables(); //TODO: remove, this variables should not be there void RegisterC2CVariables(); //TODO: move to application void RegisterCFDVariables(); //TODO: move to application void RegisterALEVariables(); //TODO: move to application void RegisterDEMVariables(); //TODO: move to application + void RegisterFSIVariables(); //TODO: move to application void RegisterMATVariables(); //TODO: move to application void RegisterLegacyStructuralAppVariables(); //TODO: move to application @@ -138,7 +139,7 @@ class KRATOS_API(KRATOS_CORE) KratosApplication { return *mpArray1DVariables; } - + KratosComponents > >::ComponentsContainerType& GetComponents(Variable > const& rComponentType) { return *mpQuaternionVariables; @@ -375,7 +376,7 @@ class KRATOS_API(KRATOS_CORE) KratosApplication const Condition mCondition3D9N; //deprecated conditions end - // Periodic Condition + // Periodic Condition const PeriodicCondition mPeriodicCondition; const PeriodicCondition mPeriodicConditionEdge; const PeriodicCondition mPeriodicConditionCorner; @@ -384,13 +385,13 @@ class KRATOS_API(KRATOS_CORE) KratosApplication //general elements must be defined const Element mElement; const Element mElement2D2N; - const Element mElement2D3N; - const Element mElement2D4N; + const Element mElement2D3N; + const Element mElement2D4N; - const Element mElement3D2N; - const Element mElement3D3N; + const Element mElement3D2N; + const Element mElement3D3N; const Element mElement3D4N; - const Element mElement3D6N; + const Element mElement3D6N; const Element mElement3D8N; const Element mElement3D10N; @@ -405,7 +406,7 @@ class KRATOS_API(KRATOS_CORE) KratosApplication KratosComponents >::ComponentsContainerType* mpDoubleVariables; KratosComponents > >::ComponentsContainerType* mpArray1DVariables; - + KratosComponents > >::ComponentsContainerType* mpQuaternionVariables; KratosComponents >::ComponentsContainerType* mpVectorVariables; @@ -622,9 +623,4 @@ inline std::ostream& operator << (std::ostream& rOStream, -#endif // KRATOS_KRATOS_APPLICATION_H_INCLUDED defined - - - - - +#endif // KRATOS_KRATOS_APPLICATION_H_INCLUDED defined diff --git a/kratos/python/add_ale_variables_to_python.cpp b/kratos/python/add_ale_variables_to_python.cpp index cecfeaa834eb..48d9b7de1da0 100644 --- a/kratos/python/add_ale_variables_to_python.cpp +++ b/kratos/python/add_ale_variables_to_python.cpp @@ -45,6 +45,7 @@ using namespace boost::python; void AddALEVariablesToPython() { KRATOS_REGISTER_IN_PYTHON_3D_VARIABLE_WITH_COMPONENTS(MESH_DISPLACEMENT) + KRATOS_REGISTER_IN_PYTHON_3D_VARIABLE_WITH_COMPONENTS(MESH_ACCELERATION) KRATOS_REGISTER_IN_PYTHON_3D_VARIABLE_WITH_COMPONENTS(MESH_REACTION) KRATOS_REGISTER_IN_PYTHON_3D_VARIABLE_WITH_COMPONENTS(MESH_RHS) } diff --git a/kratos/python/add_cfd_variables_to_python.h b/kratos/python/add_cfd_variables_to_python.h index 3303a4ad5292..756041c75ff2 100644 --- a/kratos/python/add_cfd_variables_to_python.h +++ b/kratos/python/add_cfd_variables_to_python.h @@ -12,7 +12,6 @@ // - #if !defined(KRATOS_ADD_CFD_VARIABLES_TO_PYTHON_H_INCLUDED ) #define KRATOS_ADD_CFD_VARIABLES_TO_PYTHON_H_INCLUDED diff --git a/kratos/python/add_containers_to_python.cpp b/kratos/python/add_containers_to_python.cpp index 2bacb010f352..90bfae036fd8 100644 --- a/kratos/python/add_containers_to_python.cpp +++ b/kratos/python/add_containers_to_python.cpp @@ -39,6 +39,7 @@ #include "python/add_cfd_variables_to_python.h" //TODO: to be removed eventually #include "python/add_ale_variables_to_python.h" //TODO: to be removed eventually #include "python/add_dem_variables_to_python.h" //TODO: to be removed eventually +#include "python/add_fsi_variables_to_python.h" //TODO: to be removed eventually #include "python/add_mat_variables_to_python.h" //TODO: to be removed eventually #include "python/add_legacy_structural_app_vars_to_python.h" //TODO: to be removed eventually @@ -394,7 +395,8 @@ void AddContainersToPython() AddC2CVariablesToPython(); AddDEMVariablesToPython(); //TODO: move this to the DEM application AddCFDVariablesToPython(); ///@TODO: move variables to CFD application - AddALEVariablesToPython(); ///@TODO: move variables to CFD application + AddALEVariablesToPython(); ///@TODO: move variables to ALE application + AddFSIVariablesToPython(); ///@TODO: move variables to FSI application AddMATVariablesToPython(); ///@TODO: move variables to CFD application AddLegacyStructuralAppVarsToPython(); diff --git a/kratos/python/add_fsi_variables_to_python.cpp b/kratos/python/add_fsi_variables_to_python.cpp new file mode 100644 index 000000000000..6dc0953fb5e6 --- /dev/null +++ b/kratos/python/add_fsi_variables_to_python.cpp @@ -0,0 +1,94 @@ +// | / | +// ' / __| _` | __| _ \ __| +// . \ | ( | | ( |\__ \. +// _|\_\_| \__,_|\__|\___/ ____/ +// Multi-Physics +// +// License: BSD License +// Kratos default license: kratos/license.txt +// +// Main authors: Jordi Cotela +// Ruben Zorrilla +// + + +// System includes + +// External includes +#include + + +// Project includes +#include "includes/define.h" +#include "includes/ublas_interface.h" +#include "containers/data_value_container.h" +#include "containers/flags.h" +#include "includes/fsi_variables.h" +#include "python/add_fsi_variables_to_python.h" + + + +#ifdef KRATOS_REGISTER_IN_PYTHON_IN_PYTHON_FLAG_IMPLEMENTATION +#undef KRATOS_REGISTER_IN_PYTHON_IN_PYTHON_FLAG_IMPLEMENTATION +#endif +#define KRATOS_REGISTER_IN_PYTHON_IN_PYTHON_FLAG_IMPLEMENTATION(flag) \ + scope().attr(#flag) = boost::ref(flag) \ + +#ifdef KRATOS_REGISTER_IN_PYTHON_IN_PYTHON_FLAG +#undef KRATOS_REGISTER_IN_PYTHON_IN_PYTHON_FLAG +#endif +#define KRATOS_REGISTER_IN_PYTHON_IN_PYTHON_FLAG(flag) \ + KRATOS_REGISTER_IN_PYTHON_IN_PYTHON_FLAG_IMPLEMENTATION(flag); \ + KRATOS_REGISTER_IN_PYTHON_IN_PYTHON_FLAG_IMPLEMENTATION(NOT_##flag) + +#ifdef KRATOS_REGISTER_IN_PYTHON_IN_PYTHON_VARIABLE +#undef KRATOS_REGISTER_IN_PYTHON_IN_PYTHON_VARIABLE +#endif +#define KRATOS_REGISTER_IN_PYTHON_IN_PYTHON_VARIABLE(variable) \ + scope().attr(#variable) = boost::ref(variable); + + +#ifdef KRATOS_REGISTER_IN_PYTHON_IN_PYTHON_3D_VARIABLE_WITH_COMPONENTS +#undef KRATOS_REGISTER_IN_PYTHON_IN_PYTHON_3D_VARIABLE_WITH_COMPONENTS +#endif +#define KRATOS_REGISTER_IN_PYTHON_IN_PYTHON_3D_VARIABLE_WITH_COMPONENTS(name) \ + KRATOS_REGISTER_IN_PYTHON_IN_PYTHON_VARIABLE(name) \ + KRATOS_REGISTER_IN_PYTHON_IN_PYTHON_VARIABLE(name##_X) \ + KRATOS_REGISTER_IN_PYTHON_IN_PYTHON_VARIABLE(name##_Y) \ + KRATOS_REGISTER_IN_PYTHON_IN_PYTHON_VARIABLE(name##_Z) + +namespace Kratos +{ +//KRATOS_CREATE_FLAG(STRUCTURE, 63); + +namespace Python +{ +using namespace boost::python; + +void AddFSIVariablesToPython() +{ + + //registering variables in python + KRATOS_REGISTER_IN_PYTHON_VARIABLE(CONVERGENCE_ACCELERATOR_ITERATION); + KRATOS_REGISTER_IN_PYTHON_VARIABLE(MAPPER_SCALAR_PROJECTION_RHS); + KRATOS_REGISTER_IN_PYTHON_VARIABLE(FICTITIOUS_FLUID_DENSITY); + KRATOS_REGISTER_IN_PYTHON_VARIABLE(SCALAR_PROJECTED); + KRATOS_REGISTER_IN_PYTHON_VARIABLE(FSI_INTERFACE_RESIDUAL_NORM); + KRATOS_REGISTER_IN_PYTHON_VARIABLE(FSI_INTERFACE_MESH_RESIDUAL_NORM); + + KRATOS_REGISTER_IN_PYTHON_3D_VARIABLE_WITH_COMPONENTS(MAPPER_VECTOR_PROJECTION_RHS); + KRATOS_REGISTER_IN_PYTHON_3D_VARIABLE_WITH_COMPONENTS(VAUX_EQ_TRACTION); + KRATOS_REGISTER_IN_PYTHON_3D_VARIABLE_WITH_COMPONENTS(VECTOR_PROJECTED); + KRATOS_REGISTER_IN_PYTHON_3D_VARIABLE_WITH_COMPONENTS(RELAXED_DISP); + KRATOS_REGISTER_IN_PYTHON_3D_VARIABLE_WITH_COMPONENTS(FSI_INTERFACE_RESIDUAL); + KRATOS_REGISTER_IN_PYTHON_3D_VARIABLE_WITH_COMPONENTS(FSI_INTERFACE_MESH_RESIDUAL); + KRATOS_REGISTER_IN_PYTHON_3D_VARIABLE_WITH_COMPONENTS(POSITIVE_MAPPED_VECTOR_VARIABLE); + KRATOS_REGISTER_IN_PYTHON_3D_VARIABLE_WITH_COMPONENTS(NEGATIVE_MAPPED_VECTOR_VARIABLE); + +} +} // namespace Python. +} // Namespace Kratos + +#undef KRATOS_REGISTER_IN_PYTHON_IN_PYTHON_FLAG +#undef KRATOS_REGISTER_IN_PYTHON_IN_PYTHON_VARIABLE +#undef KRATOS_REGISTER_IN_PYTHON_IN_PYTHON_3D_VARIABLE_WITH_COMPONENTS diff --git a/kratos/python/add_fsi_variables_to_python.h b/kratos/python/add_fsi_variables_to_python.h new file mode 100644 index 000000000000..c0278f9238a9 --- /dev/null +++ b/kratos/python/add_fsi_variables_to_python.h @@ -0,0 +1,42 @@ +// | / | +// ' / __| _` | __| _ \ __| +// . \ | ( | | ( |\__ \. +// _|\_\_| \__,_|\__|\___/ ____/ +// Multi-Physics +// +// License: BSD License +// Kratos default license: kratos/license.txt +// +// Main authors: Jordi Cotela +// Ruben Zorrilla +// + + +#if !defined(KRATOS_ADD_FSI_VARIABLES_TO_PYTHON_H_INCLUDED ) +#define KRATOS_ADD_FSI_VARIABLES_TO_PYTHON_H_INCLUDED + + + +// System includes + + +// External includes + + +// Project includes +#include "includes/define.h" + + +namespace Kratos +{ + +namespace Python +{ + +void AddFSIVariablesToPython(); + +} // namespace Python. + +} // namespace Kratos. + +#endif // KRATOS_ADD_FSI_VARIABLES_TO_PYTHON_H_INCLUDED defined diff --git a/kratos/sources/ale_variables.cpp b/kratos/sources/ale_variables.cpp index 9ad7eeb5d186..3f85592001dd 100644 --- a/kratos/sources/ale_variables.cpp +++ b/kratos/sources/ale_variables.cpp @@ -22,12 +22,14 @@ namespace Kratos { KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(MESH_DISPLACEMENT) + KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(MESH_ACCELERATION) KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(MESH_REACTION) KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(MESH_RHS) void KratosApplication::RegisterALEVariables() { KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(MESH_DISPLACEMENT) + KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(MESH_ACCELERATION) KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(MESH_REACTION) KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(MESH_RHS) } diff --git a/kratos/sources/fsi_variables.cpp b/kratos/sources/fsi_variables.cpp new file mode 100644 index 000000000000..9ee2ad2d7f2d --- /dev/null +++ b/kratos/sources/fsi_variables.cpp @@ -0,0 +1,65 @@ +// | / | +// ' / __| _` | __| _ \ __| +// . \ | ( | | ( |\__ \. +// _|\_\_| \__,_|\__|\___/ ____/ +// Multi-Physics +// +// License: BSD License +// Kratos default license: kratos/license.txt +// +// Main authors: Jordi Cotela +// Ruben Zorrilla +// + +// System includes +#include +#include +#include + +// External includes + +// Project includes +#include "includes/define.h" +#include "includes/fsi_variables.h" +#include "includes/kernel.h" + +namespace Kratos +{ + +KRATOS_CREATE_VARIABLE(int, CONVERGENCE_ACCELERATOR_ITERATION); +KRATOS_CREATE_VARIABLE(double, MAPPER_SCALAR_PROJECTION_RHS); +KRATOS_CREATE_VARIABLE(double, SCALAR_PROJECTED); +KRATOS_CREATE_VARIABLE(double, FICTITIOUS_FLUID_DENSITY); +KRATOS_CREATE_VARIABLE(double, FSI_INTERFACE_RESIDUAL_NORM); +KRATOS_CREATE_VARIABLE(double, FSI_INTERFACE_MESH_RESIDUAL_NORM); + +KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(MAPPER_VECTOR_PROJECTION_RHS); +KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(VAUX_EQ_TRACTION); +KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(VECTOR_PROJECTED); +KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(RELAXED_DISP); +KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(FSI_INTERFACE_RESIDUAL); +KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(FSI_INTERFACE_MESH_RESIDUAL); +KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(POSITIVE_MAPPED_VECTOR_VARIABLE); +KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(NEGATIVE_MAPPED_VECTOR_VARIABLE); + +void KratosApplication::RegisterFSIVariables() +{ + KRATOS_REGISTER_VARIABLE(CONVERGENCE_ACCELERATOR_ITERATION); + KRATOS_REGISTER_VARIABLE(MAPPER_SCALAR_PROJECTION_RHS); + KRATOS_REGISTER_VARIABLE(SCALAR_PROJECTED); + KRATOS_REGISTER_VARIABLE(FICTITIOUS_FLUID_DENSITY); + KRATOS_REGISTER_VARIABLE(FSI_INTERFACE_RESIDUAL_NORM); + KRATOS_REGISTER_VARIABLE(FSI_INTERFACE_MESH_RESIDUAL_NORM); + + KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(MAPPER_VECTOR_PROJECTION_RHS); + KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(VAUX_EQ_TRACTION); + KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(VECTOR_PROJECTED); + KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(RELAXED_DISP); + KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(FSI_INTERFACE_RESIDUAL); + KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(FSI_INTERFACE_MESH_RESIDUAL); + KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(POSITIVE_MAPPED_VECTOR_VARIABLE); + KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(NEGATIVE_MAPPED_VECTOR_VARIABLE); +} + + +} // namespace Kratos. diff --git a/kratos/sources/variables.cpp b/kratos/sources/variables.cpp index 89bab98d82b3..be3133aa404a 100644 --- a/kratos/sources/variables.cpp +++ b/kratos/sources/variables.cpp @@ -586,6 +586,7 @@ namespace Kratos KratosApplication::RegisterCFDVariables(); //TODO: move to application KratosApplication::RegisterALEVariables(); //TODO: move to application KratosApplication::RegisterDEMVariables(); //TODO: move to application + KratosApplication::RegisterFSIVariables(); //TODO: move to application KratosApplication::RegisterMATVariables(); //TODO: move to application KratosApplication::RegisterLegacyStructuralAppVariables(); //TODO: move to application diff --git a/kratos/spaces/ublas_space.h b/kratos/spaces/ublas_space.h index f29b82cab732..ae6a0e8e561e 100644 --- a/kratos/spaces/ublas_space.h +++ b/kratos/spaces/ublas_space.h @@ -2,13 +2,13 @@ // ' / __| _` | __| _ \ __| // . \ | ( | | ( |\__ ` // _|\_\_| \__,_|\__|\___/ ____/ -// Multi-Physics +// Multi-Physics // -// License: BSD License +// License: BSD License // Kratos default license: kratos/license.txt // // Main authors: Riccardo Rossi -// +// // #if !defined(KRATOS_UBLAS_SPACE_H_INCLUDED ) @@ -215,7 +215,7 @@ class UblasSpace #ifndef _OPENMP rY.assign(rX); #else - + const int size = rX.size(); if (rY.size() != static_cast(size)) rY.resize(size, false); @@ -239,7 +239,7 @@ class UblasSpace #pragma omp parallel for reduction( +: total), firstprivate(size) for(int i =0; iresize(m, n, false); + } + static void Resize(VectorType& rX, SizeType n) { rX.resize(n, false); } + static void Resize(VectorPointerType& pX, SizeType n) + { + pX->resize(n, false); + } + static void Clear(MatrixPointerType& pA) { pA->clear(); @@ -554,7 +569,7 @@ class UblasSpace #ifndef _OPENMP std::fill(rX.begin(), rX.end(), TDataType()); #else - const int size = rX.size(); + const int size = rX.size(); #pragma omp parallel for firstprivate(size) for(int i=0; i static bool WriteMatrixMarketVector(const char *FileName, VectorType& V) { // Use full namespace in call to make sure we are not calling this function recursively return Kratos::WriteMatrixMarketVector(FileName,V); } - + ///@} ///@name Friends ///@{ @@ -904,6 +919,4 @@ class UblasSpace } // namespace Kratos. -#endif // KRATOS_UBLAS_SPACE_H_INCLUDED defined - - +#endif // KRATOS_UBLAS_SPACE_H_INCLUDED defined