Commit 0302471e authored by Anne Reinarz's avatar Anne Reinarz
Browse files

add advection

parent 6217a5df
// This file was generated by the ExaHyPE toolkit.
// It will NOT be regenerated or overwritten.
// Please adapt it to your own needs.
//
// ========================
// www.exahype.eu
// ========================
#include "ADERSolver.h"
#include "ADERSolver_Variables.h"
#include "kernels/KernelUtils.h"
#include "peano/utils/Loop.h"
tarch::logging::Log Advection::ADERSolver::_log( "Advection::ADERSolver" );
int k=2*M_PI;
void Advection::ADERSolver::init(const std::vector<std::string>& cmdlineargs,const exahype::parser::ParserView& constants) {
// Tip: You find documentation for this method in header file "Advection::ADERSolver.h".
// @todo Please implement/augment if required
}
void Advection::ADERSolver::adjustPointSolution(const double* const x,const double t,const double dt,double* const Q) {
// Tip: You find documentation for this method in header file "Advection::ADERSolver.h".
// Tip: See header file "Advection::AbstractADERSolver.h" for toolkit generated compile-time
// constants such as Order, NumberOfVariables, and NumberOfParameters.
if (tarch::la::equals(t,0.0)) {
Q[0] = std::sin(k * x[0]);
}
}
void Advection::ADERSolver::boundaryValues(const double* const x,const double t,const double dt,const int faceIndex,const int direction,const double* const fluxIn,const double* const stateIn,const double* const gradStateIn,double* const fluxOut,double* const stateOut) {
// TODO: add periodic BC
//Current BC: analytic solution
stateOut[0] = std::sin(k*(x[0]-t));
double *F[2], Fs[2][1];
for(int dd=0; dd<2; dd++) F[dd] = Fs[dd];
flux(stateOut, F);
fluxOut[0] = Fs[direction][0];
}
exahype::solvers::Solver::RefinementControl Advection::ADERSolver::refinementCriterion(const double* const luh,const tarch::la::Vector<DIMENSIONS,double>& cellCentre,const tarch::la::Vector<DIMENSIONS,double>& cellSize,double t,const int level) {
// Tip: You find documentation for this method in header file "Advection::ADERSolver.h".
// Tip: See header file "Advection::AbstractADERSolver.h" for toolkit generated compile-time
// constants such as Order, NumberOfVariables, and NumberOfParameters.
// Tip: See header file "peano/utils/Loop.h" for dimension-agnostic for loops.
return exahype::solvers::Solver::RefinementControl::Keep;
}
//*****************************************************************************
//******************************** PDE ****************************************
// To use other PDE terms, specify them in the specification file, delete this
// file and its header and rerun the toolkit
//*****************************************************************************
void Advection::ADERSolver::eigenvalues(const double* const Q,const int direction,double* const lambda) {
// Tip: You find documentation for this method in header file "Advection::ADERSolver.h".
// Tip: See header file "Advection::AbstractADERSolver.h" for toolkit generated compile-time
// constants such as Order, NumberOfVariables, and NumberOfParameters.
lambda[0] = 1.0;
}
void Advection::ADERSolver::flux(const double* const Q,double** const F) {
// Tip: You find documentation for this method in header file "Advection::ADERSolver.h".
// Tip: See header file "Advection::AbstractADERSolver.h" for toolkit generated compile-time
// constants such as Order, NumberOfVariables, and NumberOfParameters.
// @todo Please implement/augment if required
F[0][0] = 1.0 * Q[0];
F[1][0] = 1.0 * Q[0];
}
{
"project_name": "Advection",
"paths": {
"peano_kernel_path": "./Peano",
"exahype_path": "./ExaHyPE",
"output_directory": "./ApplicationExamples/Advection",
"log_file": "mylogfile.log"
},
"architecture": "noarch",
"computational_domain": {
"dimension": 2,
"end_time": 1.0,
"offset": [
-0.5,
-0.5
],
"width": [
1.0,
1.0
]
},
"optimisation": {
"fuse_algorithmic_steps": "all",
"fuse_algorithmic_steps_rerun_factor": 0.99,
"fuse_algorithmic_steps_diffusion_factor": 0.99,
"spawn_predictor_as_background_thread": false,
"spawn_amr_background_threads": false,
"disable_vertex_exchange_in_time_steps": true,
"time_step_batch_factor": 0.0,
"disable_metadata_exchange_in_batched_time_steps": false,
"double_compression": 0.0,
"spawn_double_compression_as_background_thread": false
},
"solvers": [
{
"type": "ADER-DG",
"name": "ADERSolver",
"order": 3,
"maximum_mesh_size": 0.05,
"time_stepping": "globalfixed",
"aderdg_kernel": {
"language": "C",
"nonlinear": false,
"terms": [
"flux"
],
"space_time_predictor": {},
"optimised_terms": [],
"optimised_kernel_debugging": [],
"implementation": "generic"
},
"point_sources": 0,
"variables": [
{
"name": "v",
"multiplicity": 1
}
],
"plotters": [
{
"type": "vtk::Cartesian::vertices::ascii",
"name": "VtkWriter",
"time": 0.0,
"repeat": 0.02,
"output": "advection",
"variables": 1
}
]
}
]
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment