diff --git a/Applications/CLI/CMakeLists.txt b/Applications/CLI/CMakeLists.txt
index 4f65bdb9446af4278f63c21e827769ca80b1e403..5081da088fa583338f99ae3322d85d1b99edb43c 100644
--- a/Applications/CLI/CMakeLists.txt
+++ b/Applications/CLI/CMakeLists.txt
@@ -16,6 +16,10 @@ if(OGS_USE_PETSC)
     target_link_libraries(ogs ${PETSC_LIBRARIES})
 endif()
 
+if(OGS_INSITU)
+    target_link_libraries(ogs InSituLib)
+endif()
+
 ####################
 ### Tests ##########
 ####################
diff --git a/Applications/CLI/ogs.cpp b/Applications/CLI/ogs.cpp
index 0c503b81db082a6bb481ccb125804c120365ad43..fc36dbfb21734e9692ea66fe854504b74a04bfe7 100644
--- a/Applications/CLI/ogs.cpp
+++ b/Applications/CLI/ogs.cpp
@@ -23,6 +23,7 @@
 #include "Applications/ApplicationsLib/LinearSolverLibrarySetup.h"
 #include "Applications/ApplicationsLib/LogogSetup.h"
 #include "Applications/ApplicationsLib/ProjectData.h"
+#include "Applications/InSituLib/Adaptor.h"
 #include "ProcessLib/UncoupledProcessesTimeLoop.h"
 
 #include "NumLib/NumericsConfig.h"
@@ -117,11 +118,11 @@ int main(int argc, char *argv[])
                                 BaseLib::extractPath(project_arg.getValue()),
                                 outdir_arg.getValue());
 
-            // Check intermediately that config parsing went fine.
-            project_config.checkAndInvalidate();
-            BaseLib::ConfigTree::assertNoSwallowedErrors();
-
-            BaseLib::ConfigTree::assertNoSwallowedErrors();
+#ifdef USE_INSITU
+            INFO("Initialize insitu scripts.");
+            if (auto t = project_config->getConfigSubtreeOptional("insitu"))
+                InSituLib::Initialize(t->getConfigSubtree("scripts"), BaseLib::extractPath(project_arg.getValue()));
+#endif
 
             INFO("Initialize processes.");
             for (auto& p : project.getProcesses())
@@ -129,12 +130,23 @@ int main(int argc, char *argv[])
                 p.second->initialize();
             }
 
+            // Check intermediately that config parsing went fine.
+            project_config.checkAndInvalidate();
+            BaseLib::ConfigTree::assertNoSwallowedErrors();
+
+            BaseLib::ConfigTree::assertNoSwallowedErrors();
+
             BaseLib::ConfigTree::assertNoSwallowedErrors();
 
             INFO("Solve processes.");
 
             auto& time_loop = project.getTimeLoop();
             solver_succeeded = time_loop.loop();
+
+#ifdef USE_INSITU
+            if (project_config->getConfigSubtreeOptional("insitu"))
+                InSituLib::Finalize();
+ #endif
         }  // This nested scope ensures that everything that could possibly
            // possess a ConfigTree is destructed before the final check below is
            // done.
diff --git a/Applications/CMakeLists.txt b/Applications/CMakeLists.txt
index 9db2c81a5af637c39a742dfe699bae8e834b8c44..35289fb8dd5fbc3251e0ef3867d0b4773a9fb86e 100644
--- a/Applications/CMakeLists.txt
+++ b/Applications/CMakeLists.txt
@@ -17,3 +17,7 @@ endif() # OGS_BUILD_GUI
 if(OGS_BUILD_CLI)
     add_subdirectory(CLI)
 endif() # OGS_BUILD_CLI
+
+if(OGS_INSITU)
+    add_subdirectory(InSituLib)
+endif()
diff --git a/Applications/InSituLib/Adaptor.cpp b/Applications/InSituLib/Adaptor.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..76f1a0f899476e009e939910ed43bf80f32b05cb
--- /dev/null
+++ b/Applications/InSituLib/Adaptor.cpp
@@ -0,0 +1,77 @@
+/**
+ * \copyright
+ * Copyright (c) 2012-2017, OpenGeoSys Community (http://www.opengeosys.org)
+ *            Distributed under a Modified BSD License.
+ *              See accompanying file LICENSE.txt or
+ *              http://www.opengeosys.org/project/license
+ *
+ */
+
+#include "Adaptor.h"
+
+#include <vtkCPDataDescription.h>
+#include <vtkCPInputDataDescription.h>
+#include <vtkCPProcessor.h>
+#include <vtkCPPythonScriptPipeline.h>
+#include <vtkNew.h>
+#include <vtkUnstructuredGrid.h>
+
+#include "MeshLib/Mesh.h"
+#include "MeshLib/Vtk/VtkMappedMeshSource.h"
+
+namespace InSituLib
+{
+vtkCPProcessor* Processor = NULL;
+
+void Initialize(BaseLib::ConfigTree const & scripts_config, std::string const & path)
+{
+    if (Processor == NULL)
+    {
+        Processor = vtkCPProcessor::New();
+        Processor->Initialize();
+    }
+    else
+    {
+        Processor->RemoveAllPipelines();
+    }
+    for (auto script_config : scripts_config.getConfigSubtreeList("script"))
+    {
+        std::stringstream ss;
+        ss << path << script_config.getConfigParameter<std::string>("name");
+        vtkNew<vtkCPPythonScriptPipeline> pipeline;
+        pipeline->Initialize(ss.str().c_str());
+        Processor->AddPipeline(pipeline.GetPointer());
+    }
+}
+void Finalize()
+{
+    if (Processor)
+    {
+        Processor->Delete();
+        Processor = NULL;
+    }
+}
+void CoProcess(MeshLib::Mesh const& mesh, double const time,
+               unsigned int const timeStep, bool const lastTimeStep)
+{
+    vtkNew<vtkCPDataDescription> dataDescription;
+    dataDescription->AddInput("input");
+    dataDescription->SetTimeData(time, timeStep);
+    if (lastTimeStep == true)
+    {
+        // assume that we want to all the pipelines to execute if it
+        // is the last time step.
+        dataDescription->ForceOutputOn();
+    }
+    if (Processor->RequestDataDescription(dataDescription.GetPointer()) != 0)
+    {
+        INFO("Start InSitu process.");
+        vtkNew<MeshLib::VtkMappedMeshSource> vtkSource;
+        vtkSource->SetMesh(&mesh);
+        vtkSource->Update();
+        dataDescription->GetInputDescriptionByName("input")->SetGrid(vtkSource->GetOutput());
+        Processor->CoProcess(dataDescription.GetPointer());
+        INFO("End InSitu process.");
+    }
+}
+}  // namespace
diff --git a/Applications/InSituLib/Adaptor.h b/Applications/InSituLib/Adaptor.h
new file mode 100644
index 0000000000000000000000000000000000000000..5d3ec0b4e451aa546d3dc2fd997bb0c255aa0699
--- /dev/null
+++ b/Applications/InSituLib/Adaptor.h
@@ -0,0 +1,24 @@
+/**
+ * \copyright
+ * Copyright (c) 2012-2017, OpenGeoSys Community (http://www.opengeosys.org)
+ *            Distributed under a Modified BSD License.
+ *              See accompanying file LICENSE.txt or
+ *              http://www.opengeosys.org/project/license
+ *
+ */
+
+#pragma once
+
+#include "BaseLib/ConfigTree.h"
+
+namespace MeshLib {
+    class Mesh;
+}
+
+namespace InSituLib {
+
+void Initialize(BaseLib::ConfigTree const & scripts_config, std::string const & path);
+void Finalize();
+void CoProcess( MeshLib::Mesh const & mesh, double const time, unsigned int const timeStep, bool const lastTimeStep);
+
+}
diff --git a/Applications/InSituLib/CMakeLists.txt b/Applications/InSituLib/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..a8b55101ce435091d6ca95658cde2376673049bc
--- /dev/null
+++ b/Applications/InSituLib/CMakeLists.txt
@@ -0,0 +1,7 @@
+# Source files
+GET_SOURCE_FILES(SOURCES)
+
+# Library
+add_library(InSituLib ${SOURCES})
+
+# target_link_libraries(InSituLib  )
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c344513177d919997e3584f94b604c4ef15fccf1..f7e5ada0b249d8a8a5cc77001a3a4b3b7e4bb07e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -213,6 +213,7 @@ include(VtkModules)
 if(OGS_INSITU)
     include(ExternalProjectCatalyst)
     include("${PARAVIEW_USE_FILE}")
+    add_definitions(-DUSE_INSITU)
 else()
     include(ExternalProjectVtk)
 endif()
diff --git a/ProcessLib/CMakeLists.txt b/ProcessLib/CMakeLists.txt
index 029d9bc4c3c25e1837840beff4e5c733d9339273..3295d09f5058de687424e3702e55e7a4f6a7164b 100644
--- a/ProcessLib/CMakeLists.txt
+++ b/ProcessLib/CMakeLists.txt
@@ -70,3 +70,6 @@ endif()
 if(TARGET Boost)
     add_dependencies(ProcessLib Boost)
 endif()
+if(OGS_INSITU)
+    target_link_libraries(ProcessLib InSituLib)
+endif()
diff --git a/ProcessLib/Output.cpp b/ProcessLib/Output.cpp
index adb2b2ebd41503e62e2ce604238a2599fa946f41..3036cea5566549d9f6bb5811f87f5c7af4ad703b 100644
--- a/ProcessLib/Output.cpp
+++ b/ProcessLib/Output.cpp
@@ -17,6 +17,7 @@
 
 #include "BaseLib/FileTools.h"
 #include "BaseLib/RunTime.h"
+#include "Applications/InSituLib/Adaptor.h"
 
 namespace
 {
@@ -124,6 +125,11 @@ void Output::doOutputAlways(Process const& process,
 
     INFO("[time] Output of timestep %d took %g s.", timestep,
          time_output.elapsed());
+
+#ifdef USE_INSITU
+    // TODO: get number of timesteps
+    InSituLib::CoProcess(process.getMesh(), t, timestep, false);
+#endif
 }
 
 void Output::doOutput(Process const& process,