svMultiPhysics
Loading...
Searching...
No Matches
solver Directory Reference
Directory dependency graph for solver:

Directories

 
Core
 
FE
 
svOneD_interface
 
svZeroD_interface

Files

 
ActiveStress.h
 
ActiveStressLandNiederer.h
 
ActiveStressNashPanfilov.h
 
ActiveStressODE.h
 
ActiveStressRegazzoni.h
 
ActiveStressUniformSteady.h
 
ActiveStressUniformUnsteady.h
 
all_fun.h
 
Array.h
 
Array3.h
 
ArtificialNeuralNetMaterial.h
 
baf_ini.h
 
bf.h
 
BoundaryCondition.h
 
CepMod.h
 
ChnlMod.h
 
cmm.h
 
CmMod.h
 
ComMod.h
 
consts.h
 
contact.h
 
CoupledBoundaryCondition.h
 
DebugMsg.h
 
distribute.h
 
eq_assem.h
 
factory.h
 
Fibers.h
 
FourierInterpolation.h
 
fs.h
 
fsi.h
 
FsilsLinearAlgebra.h
 
initialize.h
 
Integrator.h
 
lapack_defs.h
 
lhsa.h
 
LinearAlgebra.h
 
load_msh.h
 
ls.h
 
mat_fun.h
 
mesh.h
 
nn.h
 
nn_elem_gip.h
 
nn_elem_nn_bnds.h
 
nn_elem_props.h
 
output.h
 
Parameters.h
 
petsc_impl.h
 
PetscLinearAlgebra.h
 
post.h
 
read_files.h
 
read_msh.h
 
remesh.h
 
remeshTet.h
 
ris.h
 
RobinBoundaryCondition.h
 
set_bc.h
 
set_equation_dof.h
 
set_equation_props.h
 
set_material_props.h
 
set_output_props.h
 
Simulation.h
 
SimulationLogger.h
 
SolutionStates.h
 
svOneD_interface.h
 
svZeroD_interface.h
 
Tensor4.h
 
Timer.h
 
trilinos_impl.h
 
TrilinosLinearAlgebra.h
 
txt.h
 
uris.h
 
utils.h
 
Vector.h
 
vtk_xml.h
 
vtk_xml_parser.h
 
VtkData.h

Detailed Description

svFSI_cinterface

This directory contains the C++ solver implementation. The C++ code attempts to replicate the data structures and flow of control of the Fortran implementation.

The Simulation class stores solver parameters and data, and has methods to read solver parameters from a XML file and create mesh data (e.g. nodes and element connectivity) from VTK .vtu and .vtp files. A Simulation object can be created and stored in the the Fortran CMMOD module. It can then be called to replicated the Fortran flow of control and compare data created by C++ and Fortran.

Reading the solver parameter input XML file

The Parameters class is used to read and store solver parameters from an XML file. The XML file organization and parameter names replicate the old input text file except that parameter names have spaces replaced by underscores.

Calling C++ from Fortran

The simulation_wrap.h,.cpp files provide an interface used to call C++ functions from Fortran. Data created in the C++ code can be returned to the Fortran code for comparison.

The following interface functions are defiined

C++ organizatiion to replicate Fortran

Most of the Fortran code is replicated in C++ using the same file and subroutine names converted to lower case with underscores. For example

================================================================================================
Fortran | C++
================================================================================================
SUBROUTINE READFILES | read_files()
------------------------------------------------------------------------------------------------
SUBROUTINE READMSH | read_msh()
------------------------------------------------------------------------------------------------
LOADMSH.f | load_msh.cpp
------------------------------------------------------------------------------------------------
VTKXML.f | vtk_xml.cpp
------------------------------------------------------------------------------------------------

All Fortan subroutines located in a particular file will typically have a C++ implementation in a similarly named file.

C++ functions are defined within a namespace defined for each Fortran file. For example, the functioins in load_msh.cpp are defined within the load_msh namespace. Some namespaces are named with a _ns suffix to prevent conflicts with function names (e.g. read_files_ns).

Fortran Modules

C++ classes are used to implement Fortran modules. Fortran variable names are retained to prevent (or maintain) confusion. There are no global variables. Modules are accessed from a Simulation object.

CmMod

The CmMod class implements the CMMOD module defined in COMU.f. This is used for MPI communication.

ComMod

The ComMod class implments the COMOD module defiined in MOD.f.

All solver data is stored in the ComMod class using the same names used in the COMOD module.

Flow of control

The following outlines the code flow of control for simulations.

Fortran Implementation

The following sections provide some implementation details of the Fortran/C++ interface.

PROGRAM MAIN

Fortran main program defined in MAIN.f.

function create_simulation()

simulation_interface_mod.f90

Fortran / C++ interface function to create a Simulation object.

Simulation* create_simulation()

simulation_wrap.cpp

C++ / Fortran interface function used to create a C++ Simulation object and return it to Fortran.

subroutine read_files(this, file_name)

simulation_interface_mod.f90

Fortran / C++ interface function used to call the C++ read_files() function.

subroutine distribute_data(this)

simulation_interface_mod.f90

Fortran / C++ interface function used to call the C++ () function.

subroutine initialize_solution(this, timep)

simulation_interface_mod.f90

Fortran / C++ interface function used to call the C++ () function.

subroutine iterate_solution(this)

simulation_interface_mod.f90

C++ Implementation

The following sections provide some implementation details of the C++ code replicating Fortran functionality.

void read_files(Simulation* simulation, const char* file_name)

simulation_wrap.cpp

C++ / Fortran interface function used to read in an XML file and all mesh and BC data.

void read_files_ns::read_files(Simulation* simulation, const std::string& file_name)

read_files.cpp

Read in an XML file and, all mesh and BC data. Replicates SUBROUTINE READFILES in READFILES.f

void Simulation::read_parameters(const std::string& file_name)

Simulation.cpp

Read solver parameter XML file.

void Simulation::set_module_parameters()

Simulation.cpp

Set ComMod module varliables.

void read_msh_ns::read_msh()

read_msh.cpp

Read all mesh and BCs data. Replicates SUBROUTINE READMSH in READMSH.f

void load_msh::read_sv(Simulation* simulation, mshType& mesh, const MeshParameters& param)

load_mesh.cpp

Read mesh nodal coordinates and element connectivity. Replicates SUBROUTINE READSV(list, lM) in LOADMSH.f.

void read_vtu(const std::string& file_name, mshType& mesh)

vtk_xml.cpp

Read a mesh from a SimVascular .vtu file. Replicates Fortran SUBROUTINE READVTU(lM, fName) defined in VTKXML.f.

void vtk_xml_parser::load_vtu(const std::string& file_name, mshType& mesh)

vtk_xml_parser.cpp

Read a mesh from a .vtu file and store its data into mesh. This calls VTK functions.

Replicates

subroutine loadVTK(vtk,fName,istat)
subroutine getVTK_numPoints(vtk,nn,istat)
subroutine getVTK_numElems(vtk,ne,istat)
subroutine getVTK_nodesPerElem(vtk,eNoN,istat)
subroutine getVTK_pointCoords(vtk,x,istat)
subroutine getVTK_elemIEN(vtk,ien,istat)

defined in vtkXMLParser.f90.

The following mesh variables are set

mesh.gnNo - number of nodes
mesh.x - node coordinates
mesh.gN - node IDs
mesh.gnEl - number of elements
mesh.eNoN - number of noders per element
mesh.gIEN - element connectivity (num_nodes_per_elem, num_elems)

nn::select_ele(Simulation* simulation, mshType& mesh)

nn.cpp

Set mesh variables for the input element type.

std::map<int, std::function<void(int, mshType&)>> set_3d_element_props[]

nn_elem_props.h

A map used to set 3D element properties based on the number of element nodes. This replicates the case statement in the Fortran 'SUBROUTINE SELECTELE(lM)' defined in NN.f.

nn::get_gip(Simulation* simulation, mshType& mesh)

nn.cpp

Set mesh w and xi arrays used for Gauss integration.

nn:get_gnn(Simulation* simulation, int gaus_pt, mshType& mesh)

nn.cpp

Create mesh N and Nx shape function arrays for a Gauss point gaus_pt.

nn::get_nn_bnds(Simulation* simulation, mshType& mesh)

nn.cpp

Create bounds on Gauss integration points and shape functions. Replicates Fortran SUBROUTINE GETNNBNDSlMeType, lMeNoN, lMxib, lMNb).

read_msh_ns::check_ien(Simulation* simulation, mshType& mesh)

read_msh.cpp

Check the mesh connectivity and node ordering. It may reorder element connectivity. Replicates the Fortran CHECKIEN subroutine defined in READMSH.f.

std::map<consts::ElementType, std::function<void(mshType&)>> read_msh_ns::check_element_conn

read_msh.cpp

A map of function pointers used to check element connecivity.

vtk_xml::read_vtp(const std::string& file_name, faceType& face)

vtk_xml.cpp

Read a face nodal coordinates and element connectivity from a SimVascular .vtp file. Sets data in faceType face:

Replicates Fortran READVTP subroutine defined in VTKXML.f.

vtk_xml_parser::load_vtp(const std::string& file_name, faceType& face)

vtk_xml_parser.cpp

Store a surface mesh read in from a VTK .vtp file into a faceType object.

nn::select_eleb(Simulation* simulation, mshType& mesh, faceType& face))

nn.cpp

Set face properties for the input element type.

std::map<int, std::function<void(int, mshType&)>> set_face_element_props

nn_elem_props.h

A map type used to set element properties.

get_gip(Simulation* simulation, faceType& face)

nn.cpp

get_gnn(Simulation* simulation, int gaus_pt, faceType& face)

nn.cpp

Computes shape functions and derivatives at given natural coords.

set_projector(simulation, avNds)

read_msh.cpp

Associates two faces with each other and sets gN, matches the nodal coordinates for each projection face.

find_face(com_mod.msh, ctmpi, iM, iFa)

all_fun.cpp

match_faces(const ComMod& com_mod, const faceType& lFa, const faceType& pFa, const double ptol, utils::stackType& lPrj)

read_msh.cpp

Match isoparameteric faces to each other.

int find_blk(const int nsd, const int nBkd, const std::vector<bool>& nFlt, const Vector<double>&xMin, const Vector<double>&dx, const Vector<double>& x)

read_msh.cpp

Compute the block ID for the given coordinate.

read_fib_nff(Simulation* simulation, mshType& mesh, const std::string& fName, const std::string& kwrd, const int idx)

read_msh.cpp

Read fiber direction from a vtu file.

load_fiber_direction_vtu(const std::string& file_name, const std::string& data_name, const int idx, const int nsd, mshType& mesh" </h2> <a href="https://github.com/ktbolt/svFSI/blob/Implement-svFSI-using-cpp_19/Code/Source/svFSI_cinterface/vtk_xml_parser.cpp" >vtk_xml_parser.cpp</a> Read fiber direction data from a VTK VTU file and copy it into a mesh. <h2 id="read_vtu_pdata"> read_vtu_pdata(const std::string& fName, const std::string& kwrd, const int nsd, const int m, const int idx, mshType& mesh) </h2> <a href="https://github.com/ktbolt/svFSI/blob/Implement-svFSI-using-cpp_19/Code/Source/svFSI_cinterface/vtk_xml.cpp" >vtk_xml.cpp</a> Read prestress data from a vtu file. @icode auto vtk_data = VtkData::create_reader(fName); int num_elems = vtk_data->num_elems(); int num_points = vtk_data->num_points(); @endicode <h2 id="load_var_ini"> load_var_ini(Simulation* simulation, ComMod& com_mod) </h2> <a href="https://github.com/ktbolt/svFSI/blob/Implement-svFSI-using-cpp_19/Code/Source/svFSI_cinterface/read_msh.cpp" >read_msh.cpp</a> Read initial field values (pressure, velocity or displacement). <h2 id="read_eq"> read_eq(Simulation* simulation, EquationParameters& eq_params, eqType& lEq) </h2> <a href="https://github.com/ktbolt/svFSI/blob/Implement-svFSI-using-cpp_19/Code/Source/svFSI_cinterface/read_files.cpp" >read_files.cpp</a> Set equation parameters. - <tt>set_equation_properties(simulation, eq_params, lEq, propL, outPuts, nDOP)</tt> <h2 id="set_equation_properties"> set_equation_properties(Simulation* simulation, EquationParameters& eq_params, eqType& lEq, EquationProps& propL, EquationOutputs& outPuts, EquationNdop& nDOP) </h2> <a href="https://github.com/ktbolt/svFSI/blob/Implement-svFSI-using-cpp_19/Code/Source/svFSI_cinterface/read_files.cpp" >read_files.cpp</a> Set equation properties. - eq_type = equation_name_to_type.at(eq_type_str) - <tt>set_equation_props[eq_type](simulation, eq_params, lEq, propL, outPuts, nDOP)</tt> - Execute function based on 'eq_type' <h2 id="set_equation_props"> std::map<consts::EquationType, std::function&lt;void(Simulation*, EquationParameters&, eqType&, EquationProps&, EquationOutputs&, EquationNdop&)&gt;&gt;) </h2> <a href="https://github.com/ktbolt/svFSI/blob/Implement-svFSI-using-cpp_19/Code/Source/svFSI_cinterface/set_equation_props.h" >set_equation_props.h</a> A map of lambda functions used to set equation properties. <h2 id="read_outputs"> read_outputs(Simulation* simulation, EquationParameters& eq_params, eqType& lEq, EquationNdop& nDOP, EquationOutputs& outPuts) </h2> <a href="https://github.com/ktbolt/svFSI/blob/Implement-svFSI-using-cpp_19/Code/Source/svFSI_cinterface/read_files.cpp" >read_files.cpp</a> Set output parameters. <h2 id="read_bc"> read_bc(Simulation* simulation, EquationParameters& eq_params, eqType& lEq, BoundaryConditionParameters& bc_params, bcType& lBc) </h2> <a href="https://github.com/ktbolt/svFSI/blob/Implement-svFSI-using-cpp_19/Code/Source/svFSI_cinterface/read_files.cpp" >read_files.cpp</a> Read boundary condition data. - <tt>read_trac_bcff(com_mod, lBc.gm, com_mod.msh[iM].fa[iFa], file_name)</tt> - <tt>read_temporal_values_file(file_name, lBc)</tt> - <tt>read_fourier_coeff_values_file(file_name, lBc)</tt> - <tt>read_bct(com_mod, lBc.gm, com_mod.msh[iM].fa[iFa], file_name)</tt> - <tt>read_temporal_and_spatial_values_file(com_mod, com_mod.msh[iM], com_mod.msh[iM].fa[iFa], file_name, lBc)</tt> - <tt>read_spatial_values_file(com_mod, com_mod.msh[iM], com_mod.msh[iM].fa[iFa], file_name, lBc)</tt> - <tt>vtk_xml::read_vtp_pdata(cTmp, \"Stress\", com_mod.nsd, com_mod.nsymd, data_series, face)</tt> - <tt>vtk_xml::read_vtp_pdata(cTmp, \"Displacement\", com_mod.nsd, com_mod.nsd, data_series, face)</tt> <h2 id="read_trac_bcff"> read_trac_bcff(ComMod& com_mod, MBType& lMB, faceType& lFa, const std::string& fName) </h2> <a href="https://github.com/ktbolt/svFSI/blob/Implement-svFSI-using-cpp_19/Code/Source/svFSI_cinterface/read_files.cpp" >read_files.cpp</a> Reads pressure/traction data from a vtp file and stores in moving BC data structure. @icode VtkVtpData vtp_data(fName) int num_points = vtp_data.num_points(); @endicode <h2 id="read_temporal_values_file"> read_temporal_values_file(const std::string& file_name, bcType& lBc) </h2> <a href="https://github.com/ktbolt/svFSI/blob/Implement-svFSI-using-cpp_19/Code/Source/svFSI_cinterface/read_files.cpp" >read_files.cpp</a> Set boundary condition temporal values read in from a file. <h2 id="read_fourier_coeff_values_file"> read_fourier_coeff_values_file(const std::string& file_name, bcType& lBc) </h2> <a href="https://github.com/ktbolt/svFSI/blob/Implement-svFSI-using-cpp_19/Code/Source/svFSI_cinterface/read_files.cpp" >read_files.cpp</a> Set boundary condition Fourier coefficients read in from a file. <h2 id="read_bct"> read_bct(ComMod& com_mod, MBType& lMB, faceType& lFa, const std::string& fName) </h2> <a href="https://github.com/ktbolt/svFSI/blob/Implement-svFSI-using-cpp_19/Code/Source/svFSI_cinterface/read_files.cpp" >read_files.cpp</a> Reads general velocity data from bct.vtp. @icode VtkVtpData vtp_data(fName); int num_points = vtp_data.num_points(); if (num_points == 0) { @endicode <h2 id="read_spatial_values_file"> read_spatial_values_file(const ComMod& com_mod, const mshType& msh, const faceType& lFa, const std::string& file_name, bcType& lBc) </h2> <a href="https://github.com/ktbolt/svFSI/blob/Implement-svFSI-using-cpp_19/Code/Source/svFSI_cinterface/read_files.cpp" >read_files.cpp</a> Read in a file containing spatial values used for a boundary condition. <h2 id="distribute_data"> distribute_data(Simulation* simulation) </h2> <a href="https://github.com/ktbolt/svFSI/blob/Implement-svFSI-using-cpp_19/Code/Source/svFSI_cinterface/simulation_wrap.cpp" >simulation_wrap.cpp</a> C++ / Fortran interface function used to distribute data to MPI processes. - <tt>distribute(simulation)</tt> <h2 id="distribute"> distribute(Simulation* simulation) </h2> <a href="https://github.com/ktbolt/svFSI/blob/Implement-svFSI-using-cpp_19/Code/Source/svFSI_cinterface/distribute.cpp" >distribute.cpp</a> Partition and distribute data across processors. - <tt>all_fun::split_jobs(task_id, nMsh, num_proc, wgt, wrk)</tt> - <tt>part_msh(simulation, com_mod.msh[iM], gmtl, num_proc, iWgt)</tt> - <tt>part_face(simulation, msh, face, tMs[iM].fa[iFa], gmtl)</tt> <h2 id="bcast"> cmType::bcast(const CmMod& cm_mod, ...) </h2> <a href="https://github.com/ktbolt/svFSI/blob/Implement-svFSI-using-cpp_19/Code/Source/svFSI_cinterface/CmMod.cpp" >CmMod.cpp</a> Interfacee to <tt>MPI_Bcast()</tt>. <h2 id="split_jobs"> split_jobs(int tid, int m, int n, Array<double>& A, Vector<double>& b) </h2> <a href="https://github.com/ktbolt/svFSI/blob/Implement-svFSI-using-cpp_19/Code/Source/svFSI_cinterface/all_fun.cpp" >all_fun.cpp</a> Spliting "m" jobs between "n" workers. <h2 id="part_msh"> part_msh(Simulation* simulation, mshType& lM, Vector<int>& gmtl, int nP, Vector<float>& wgt) </h2> <a href="https://github.com/ktbolt/svFSI/blob/Implement-svFSI-using-cpp_19/Code/Source/svFSI_cinterface/distribute.cpp" >distribute.cpp</a> Partition a mesh amongst N processors. - Broadcast mesh data. @icode cm.bcast(cm_mod, &lM.lShpF); cm.bcast(cm_mod, &lM.lShl); cm.bcast(cm_mod, &lM.lFib); cm.bcast(cm_mod, &eType); cm.bcast(cm_mod, &lM.eNoN); cm.bcast(cm_mod, &lM.nFa); cm.bcast(cm_mod, &lM.nFs); cm.bcast(cm_mod, &lM.nG); cm.bcast(cm_mod, &lM.gnEl); cm.bcast(cm_mod, &lM.gnNo); cm.bcast(cm_mod, lM.name); cm.bcast(cm_mod, &lM.scF); @endicode - Set face properties for the input element type @icode nn::select_ele(simulation, lM)` @endicode - Scattering the lM.gIEN array to all processors. @icode MPI_Scatterv(lM.gIEN.data_, sCount.data_, disp.data_, cm_mod::mpint, lM.IEN.data_, nEl*eNoN, cm_mod::mpint, cm_mod.master, cm.com()) @endicode - Doing partitioning, using ParMetis @icode auto edgecut = split_(&nEl, &eNoN, &eNoNb, lM.IEN.data_, &num_proc, lM.eDist.data_, wgt.data_, part.data_)` @endicode - Gathering the parts inside master @icode MPI_Gatherv(part.data_, nEl, cm_mod::mpint, gPart.data_, sCount.data_, disp.data_, cm_mod::mpint, cm_mod.master, cm.com()) @endicode - Communicating eId, if neccessary @icode MPI_Scatterv(tempIEN.data_, sCount.data_, disp.data_, cm_mod::mpint, lM.IEN.data_, nEl*eNoN, cm_mod::mpint, cm_mod.master, cm.com()) @endicode - Communicating fN, if neccessary @icode MPI_Scatterv(tmpFn.data_, sCount.data_, disp.data_, cm_mod::mpreal, lM.fN.data_, nEl*nFn*nsd, cm_mod::mpreal, cm_mod.master, cm.com()); @endicode - scattering the sorted lM%IEN to all processors. @icode MPI_Scatterv(tempIEN.data_, sCount.data_, disp.data_, cm_mod::mpint, lM.IEN.data_, nEl*eNoN, cm_mod::mpint, cm_mod.master, cm.com()); @endicode - Constructing the initial global to local pointer <h2 id="part_face"> part_face(Simulation* simulation, mshType& lM, faceType& lFa, faceType& gFa, Vector<int>& gmtl) </h2> <a href="https://github.com/ktbolt/svFSI/blob/Implement-svFSI-using-cpp_19/Code/Source/svFSI_cinterface/distribute.cpp" >distribute.cpp</a> Partition faces across processors. - Broadcast the number of nodes and elements of to slaves @icode cm.bcast(cm_mod, &gFa.d); cm.bcast(cm_mod, &gFa.eNoN); cm.bcast(cm_mod, &gFa.iM); cm.bcast(cm_mod, &gFa.nEl); cm.bcast(cm_mod, &gFa.gnEl); cm.bcast(cm_mod, &gFa.nNo); @endicode - <tt>nn::select_eleb(simulation, lM, gFa)</tt> - Set face properties for the input element type. <h2 id="dist_eq"> dist_eq(ComMod& com_mod, const CmMod& cm_mod, const cmType& cm, const std::vector<mshType>& tMs, const Vector<int>& gmtl, CepMod& cep_mod, eqType& lEq) </h2> <a href="https://github.com/ktbolt/svFSI/blob/Implement-svFSI-using-cpp_19/Code/Source/svFSI_cinterface/distribute.cpp" >distribute.cpp</a> Distribute equation data to processors. - Distribute equation parameters @icode cm.bcast(cm_mod, &lEq.nOutput); cm.bcast(cm_mod, &lEq.coupled); cm.bcast(cm_mod, &lEq.maxItr); cm.bcast(cm_mod, &lEq.minItr); cm.bcast(cm_mod, &lEq.roInf); cm.bcast_enum(cm_mod, &lEq.phys); ... @endicode - Distribute linear solver settings @icode cm.bcast(cm_mod, &lEq.FSILS.foC); cm.bcast_enum(cm_mod, &lEq.FSILS.LS_type); cm.bcast(cm_mod, &lEq.FSILS.RI.relTol); cm.bcast(cm_mod, &lEq.FSILS.GM.relTol); cm.bcast(cm_mod, &lEq.FSILS.CG.relTol); ... @endicode - Distribute domain properties - <tt>dist_mat_consts(com_mod, cm_mod, cm, dmn.stM)</tt> <h2 id="dist_mat_consts"> dist_mat_consts(const ComMod& com_mod, const CmMod& cm_mod, const cmType& cm, stModelType& lStM) </h2> <a href="https://github.com/ktbolt/svFSI/blob/Implement-svFSI-using-cpp_19/Code/Source/svFSI_cinterface/distribute.cpp" >distribute.cpp</a> Distribute material properties to all processors. <h2 id="dist_bc"> dist_bc(ComMod& com_mod, const CmMod& cm_mod, const cmType& cm, bcType& lBc, const std::vector<mshType>& tMs, const Vector<int>& gmtl) </h2> <a href="https://github.com/ktbolt/svFSI/blob/Implement-svFSI-using-cpp_19/Code/Source/svFSI_cinterface/distribute.cpp" >distribute.cpp</a> Distribute boundary condition data to all processors. <h2 id="dist_visc_model"> dist_visc_model(const ComMod& com_mod, const CmMod& cm_mod, const cmType& cm, fluidViscModelType& lVis) </h2> <a href="https://github.com/ktbolt/svFSI/blob/Implement-svFSI-using-cpp_19/Code/Source/svFSI_cinterface/distribute.cpp" >distribute.cpp</a> Distribute viscosity model to processors. <h2 id="dist_bf"> dist_bf(ComMod& com_mod, const CmMod& cm_mod, const cmType& cm, bfType& lBf) </h2> <a href="https://github.com/ktbolt/svFSI/blob/Implement-svFSI-using-cpp_19/Code/Source/svFSI_cinterface/distribute.cpp" >distribute.cpp</a> Distribute boundary fource to processors. <h2 id="initialize_solution"> initialize_solution(Simulation* simulation, double* timep) </h2> <a href="https://github.com/ktbolt/svFSI/blob/Implement-svFSI-using-cpp_19/Code/Source/svFSI_cinterface/simulation_wrap.cpp" >simulation_wrap.cpp</a> C++ / Fortran interface function used to initialize the solution. - <tt>initialize(simulation, timeP)</tt> <h2 id="initialize"> initialize(Simulation* simulation, Vector<double>& timeP) </h2> <a href="https://github.com/ktbolt/svFSI/blob/Implement-svFSI-using-cpp_19/Code/Source/svFSI_cinterface/initialize.cpp" >initialize.cpp</a> Initialize or finalize svFSI variables/structures. Sets the following for each com_mod.eq[]. @icode eq.am eq.dof eq.pNorm eq.af eq.beta eq.gam eq.s eq.e com_mod.Ao.resize(tDof,tnNo); com_mod.An.resize(tDof,tnNo); com_mod.Yo.resize(tDof,tnNo); com_mod.Yn.resize(tDof,tnNo); com_mod.Do.resize(tDof,tnNo); com_mod.Dn.resize(tDof,tnNo); com_mod.Bf.resize(nsd,tnNo); com_mod.An = com_mod.Ao; com_mod.Yn = com_mod.Yo; com_mod.Dn = com_mod.Do; @endicode - <tt>mat_fun::ten_init(nsd)</tt> - <tt>lhsa_ns::lhsa(simulation, nnz)</tt> - Constructing stiffness matrix - <tt>fsi_linear_solver::fsils_lhs_create(com_mod.lhs, communicator, com_mod.gtnNo, com_mod.tnNo, nnz, com_mod.ltg, com_mod.rowPtr, com_mod.colPtr, nFacesLS)</tt> - <tt>cep_ion::cep_init(simulation)</tt> - <tt>fs::init_fs_msh(com_mod, mesh)</tt> - <tt>baf_ini_ns::baf_ini(simulation)</tt> - <tt>set_bc::set_bc_dir(com_mod, com_mod.Ao, com_mod.Yo, com_mod.Do)</tt> - <tt>txt_ns::txt(simulation, true)</tt> <h2 id="lsh"> void lhsa(Simulation* simulation, int& nnz) </h2> <a href="https://github.com/ktbolt/svFSI/blob/Implement-svFSI-using-cpp_19/Code/Source/svFSI_cinterface/lhsa.cpp" >lhsa.cpp</a> Create data structure and assembling LHS sparse matrix. Modifies: @icode com_mod.idMap com_mod.colPtr com_mod.rowPtr @endicode <h2 id="fsils_commu_create"> void fsils_commu_create(FSILS_commuType& commu, cm_mod::MpiCommWorldType commi) </h2> <a href="https://github.com/ktbolt/svFSI/blob/Implement-svFSI-using-cpp_19/Code/Source/svFSILS_cinterface/commu.cpp" >commu.cpp</a> Modifies: @icode commu.task commu.nTasks commu.foC = true; commu.comm = commi; commu.nTasks = 1; commu.task = 0; commu.master = 0; @endicode <h2 id="fsils_lhs_create"> void fsils_lhs_create(FSILS_lhsType& lhs, FSILS_commuType& commu, int gnNo, int nNo, int nnz, Vector<int>& gNodes, Vector<int> &rowPtr, Vector<int>& colPtr, int nFaces) </h2> <a href="https://github.com/ktbolt/svFSI/blob/Implement-svFSI-using-cpp_19/Code/Source/svFSILS_cinterface/lhs.cpp" >lhs.cpp</a> Create data structure and assembling LHS sparse matrix. Modifies: @icode lhs.foC lhs.gnNo lhs.nNo lhs.nnz lhs.commu lhs.nFaces lhs.mynNo lhs.colPtr lhs.rowPtr lhs.diagPtr lhs.map lhs.face @endicode <h2 id="cep_init"> void cep_init(Simulation* simulation) </h2> <a href="https://github.com/ktbolt/svFSI/blob/Implement-svFSI-using-cpp_19/Code/Source/svFSI_cinterface/cep_ion.cpp" >cep_ion.cpp</a> Modifies @icode cep_mod.Xion @endicode - <tt>IonicModel::init(Xl, Xgl)</tt> - <tt>all_fun::commu(com_mod, sA)</tt> - <tt>all_fun::commu(com_mod, sF)</tt> <h2 id="init_fs_msh"> void init_fs_msh(const ComMod& com_mod, mshType& lM) </h2> <a href="https://github.com/ktbolt/svFSI/blob/Implement-svFSI-using-cpp_19/Code/Source/svFSI_cinterface/fs.cpp" >fs.cpp</a> Modifies @icode lM.fs.resize(lM.nFs) lM.fs[0].lShpF = lM.lShpF; lM.fs[0].eType = lM.eType; lM.fs[0].eNoN = lM.eNoN; lM.fs[0].nG = lM.nG; @endicode - <tt>nn::get_gn_nxx(insd, ind2, lM.fs[0].eType, lM.fs[0].eNoN, g, lM.fs[0].xi, lM.fs[0].Nxx)</tt> - <tt>set_thood_fs(lM.fs[1], lM.fs[0].eType)</tt> - <tt>alloc_fs(lM.fs[1], nsd, insd)</tt> <h2 id="baf_ini"> void baf_ini(Simulation* simulation) </h2> <a href="https://github.com/ktbolt/svFSI/blob/Implement-svFSI-using-cpp_19/Code/Source/svFSI_cinterface/baf_ini.cpp" >baf_ini.cpp</a> Modifies @icode com_mod.cplBC.fa com_mod.cplBC.xn com_mod.cplBC.fa[i].RCR.Rp = bc.RCR.Rp; com_mod.cplBC.fa[i].RCR.C = bc.RCR.C; com_mod.cplBC.fa[i].RCR.Rd = bc.RCR.Rd; com_mod.cplBC.fa[i].RCR.Pd = bc.RCR.Pd; com_mod.cplBC.fa[i].RCR.Xo = bc.RCR.Xo; @endicode - <tt>face_ini(simulation, msh, face)</tt> - Compute face normals and area - <tt>shl_ini(com_mod, cm_mod, com_mod.msh[iM])</tt> - <tt>bc_ini(com_mod, cm_mod, bc, com_mod.msh[iM].fa[iFa])</tt> - Initialize face BC profile - <tt>shl_bc_ini(com_mod, cm_mod, bc, com_mod.msh[iM].fa[iFa], com_mod.msh[iM])</tt> - <tt>set_bc::rcr_init(com_mod, cm_mod)</tt> - <tt>set_bc::genBC_Integ_X(com_mod, cm_mod, \"I\")</tt> - <tt>set_bc::calc_der_cpl_bc(com_mod, cm_mod)</tt> - <tt>fsi_ls_ini(com_mod, cm_mod, bc, com_mod.msh[iM].fa[iFa], lsPtr)</tt> - <tt>fsils_bc_create(com_mod.lhs, lsPtr, i, nsd, BcType::BC_TYPE_Dir, gNodes)</tt> <h2 id="fsi_ls_ini"> void fsi_ls_ini(ComMod& com_mod, const CmMod& cm_mod, bcType& lBc, const faceType& lFa, int& lsPtr) </h2> <a href="https://github.com/ktbolt/svFSI/blob/Implement-svFSI-using-cpp_19/Code/Source/svFSI_cinterface/baf_ini.cpp" >baf_ini.cpp</a> Modifies @icode @endicode - <tt>fsils_bc_create(com_mod.lhs, lsPtr, lFa.nNo, nsd, BcType::BC_TYPE_Dir, gNodes, sVl)</tt> <h2 id="fsils_bc_create"> void fsils_bc_create(FSILS_lhsType& lhs, int faIn, int nNo, int dof, BcType BC_type, const Vector<int>& gNodes, Array<double> Val) </h2> <a href="https://github.com/ktbolt/svFSI/blob/Implement-svFSI-using-cpp_19/Code/Source/svFSILS_cinterface/bc.cpp" >bc.cpp</a> Modifies @icode lhs.face[faIn] @endicode - <tt>MPI_Allreduce(\&a, \&Ac, 1, cm_mod::mpint, MPI_SUM, lhs.commu.comm)</tt> - <tt>fsils_commuv(lhs, dof, v)</tt> <h2 id="set_bc_dir"> void set_bc_dir(ComMod& com_mod, Array<double>& lA, Array<double>& lY, Array<double>& lD) </h2> <a href="https://github.com/ktbolt/svFSI/blob/Implement-svFSI-using-cpp_19/Code/Source/svFSI_cinterface/set_bc.cpp" >set_bc.cpp</a> Modifies @icode com_mod.Ad lA(tDof, tnNo) lY(tDof, tnNo) lD(tDof, tnNo) @endicode - <tt>set_bc::set_bc_dir_l(com_mod, bc, com_mod.msh[iM].fa[iFa], tmpA, tmpY, lDof)</tt> <h2 id="set_bc_dir_l"> void set_bc_dir_l(ComMod& com_mod, const bcType& lBc, const faceType& lFa, Array<double>& lA, Array<double>& lY, int lDof) </h2> <a href="https://github.com/ktbolt/svFSI/blob/Implement-svFSI-using-cpp_19/Code/Source/svFSI_cinterface/set_bc.cpp" >set_bc.cpp</a> Modifies @icode @endicode - <tt>igbc(com_mod, lBc.gm, lY, lA)</tt> - calculating values by the inverse of general BC - <tt>ifft(com_mod, lBc.gt, dirY_v, dirA_v)</tt> <h2 id="iterate_solution"> void iterate_solution(Simulation* simulation) </h2> <a href="https://github.com/ktbolt/svFSI/blob/Implement-svFSI-using-cpp_19/Code/Source/svFSI_cinterface/simulation_wrap.cpp" >simulation_wrap.cpp</a> - <tt>read_msh_ns::calc_mesh_props(com_mod, cm_mod, com_mod.nMsh, com_mod.msh)</tt> - <tt>pic::picp(simulation)</tt> - <tt>set_bc::set_bc_dir(com_mod, An, Yn, Dn)</tt> - Inner loop for iteration - <tt>set_bc::set_bc_cpl(com_mod, cm_mod)</tt> - <tt>set_bc::set_bc_dir(com_mod, An, Yn, Dn)</tt> - <tt>pic::pici(simulation, Ag, Yg, Dg)</tt> - <tt>ls_ns::ls_alloc(com_mod, eq)</tt> - <tt>bf::set_bf(com_mod, Dg)</tt> - <tt>eq_assem::global_eq_assem(com_mod, com_mod.msh[iM], Ag, Yg, Dg)</tt> - For each mesh - <tt>set_bc::set_bc_neu(com_mod, cm_mod, Yg, Dg)</tt> - <tt>set_bc::set_bc_cmm(com_mod, cm_mod, Ag, Dg)</tt> - <tt>set_bc::set_bc_dir_w(com_mod, Yg, Dg)</tt> - Apply weakly applied Dirichlet BCs - <tt>contact::contact_forces(com_mod, cm_mod, Dg)</tt> - <tt>all_fun::commu(com_mod, com_mod.R)</tt> - Synchronize residual across processes - <tt>ustruct::ustruct_r(com_mod, Yg)</tt> - <tt>fs::thood_val_rc(com_mod)</tt> - <tt>set_bc::set_bc_undef_neu(com_mod)</tt> - <tt>ls_ns::ls_solve(com_mod, eq, incL, res)</tt> - <tt>pic::picc(simulation)</tt> <h2 id="picp"> void picp(Simulation* simulation) </h2> <a href="https://github.com/ktbolt/svFSI/blob/Implement-svFSI-using-cpp_19/Code/Source/svFSI_cinterface/pic.cpp" >pic.cpp</a> Modifies @icode pS0 Ad Ao Yo Do An Yn Dn @endicode - <tt>cep_ion::cep_integ(simulation, iEq, e, Do)</tt> <h2 id="ls_alloc"> void ls_alloc(ComMod& com_mod, eqType& lEq) </h2> <a href="https://github.com/ktbolt/svFSI/blob/Implement-svFSI-using-cpp_19/Code/Source/svFSI_cinterface/ls.cpp" >ls.cpp</a> Allocate <tt>com_mod.R</tt> and <tt>com_mod.Val</tt> arrays. Modifies @icode com_mod.R - Residual vector com_mod.Val - LHS matrix @endicode - if using trilinos - <tt>trilinos_lhs_create_(gtnNo, lhs.mynNo, tnNo, lhs.nnz, tls.ltg.data(), com_mod.ltg.data(), com_mod.rowPtr.data(), com_mod.colPtr.data(), dof)</tt> <h2 id="set_bf"> void set_bf(ComMod& com_mod, Array<double>& Dg) </h2> <a href="https://github.com/ktbolt/svFSI/blob/Implement-svFSI-using-cpp_19/Code/Source/svFSI_cinterface/bf.cpp" >bf.cpp</a> - <tt>set_bf_l(com_mod, eq.bf[iBf], com_mod.msh[iM], Dg)</tt> <h2 id="set_bf_l"> void set_bf_l(ComMod& com_mod, bfType& lBf, mshType& lM, Array<double>& Dg) </h2> <a href="https://github.com/ktbolt/svFSI/blob/Implement-svFSI-using-cpp_19/Code/Source/svFSI_cinterface/bf.cpp" >bf.cpp</a> Modifies @icode com_mod.Bf @endicode - <tt>ifft(com_mod, lBf.bt, f, rtmp)</tt> - If BodyForceType::bfType_ustd - <tt>igbc(com_mod, lBf.bm, bfl, xl)</tt> - If BodyForceType::bfType_gen - <tt>bf_construct(com_mod, lM, e, eNoN, idof, xl, dl, bfl, ptr)</tt> <h2 id="bf_construct"> void bf_construct(ComMod& com_mod, const mshType& lM, const int e, const int eNoN, const int idof, Array<double>& xl, const Array<double>& dl, const Array<double>& bfl, const Vector<int>& ptr) </h2> <a href="https://github.com/ktbolt/svFSI/blob/Implement-svFSI-using-cpp_19/Code/Source/svFSI_cinterface/bf.cpp" >bf.cpp</a> - <tt>cmm::bcmmi(com_mod, eNoN, idof, w, N, Nx, xl, bfl, lR)</tt> - <tt>trilinos_doassem_(const_cast\<int\&\>(eNoN), ptr.data(), lK.data(), lR.data())</tt> - If using Trilinos - <tt>lhsa_ns::do_assem(com_mod, eNoN, ptr, lK, lR)</tt> - If not using Trilinos <h2 id="global_eq_assem"> void global_eq_assem(ComMod& com_mod, const mshType& lM, const Array<double>& Ag, const Array<double>& Yg, const Array<double>& Dg) </h2> <a href="https://github.com/ktbolt/svFSI/blob/Implement-svFSI-using-cpp_19/Code/Source/svFSI_cinterface/eq_assem.cpp" >eq_assem.cpp</a> - `fluid::construct_fluid(com_mod, lM, Ag, Yg) - If EquationType::phys_fluid <h2 id="construct_fluid"> void construct_fluid(ComMod& com_mod, const mshType& lM, const Array<double>& Ag, const Array<double>& Yg) </h2> <a href="https://github.com/ktbolt/svFSI/blob/Implement-svFSI-using-cpp_19/Code/Source/svFSI_cinterface/fluid.cpp" >fluid.cpp</a> This is for solving fluid transport equation solving Navier-Stokes equations. Dirichlet boundary conditions are either treated strongly or weakly. - <tt>fs::get_thood_fs(com_mod, fs, lM, vmsStab, 1)</tt> - <tt>nn::gnn(fs[1].eNoN, nsd, nsd, Nx, xql, Nqx, Jac, ksix)</tt> - <tt>nn::gn_nxx(l, fs[0].eNoN, nsd, nsd, Nx, Nxx, xwl, Nwx, Nwxx)</tt> - <tt>fluid_3d_m(com_mod, vmsStab, fs[0].eNoN, fs[1].eNoN, w, ksix, N0, N1, Nwx, Nqx, Nwxx, al, yl, bfl, lR, lK, brinkman_inverse_permeability)</tt> - If nsd=3 - <tt>fluid_2d_m(com_mod, vmsStab, fs[0].eNoN, fs[1].eNoN, w, ksix, N0, N1, Nwx, Nqx, Nwxx, al, yl, bfl, lR, lK, brinkman_inverse_permeability)</tt> - If nsd=2 - <tt>trilinos_doassem_(const_cast\<int\&\>(eNoN), ptr.data(), lK.data(), lR.data())</tt> - If using Trilinos - <tt>lhsa_ns::do_assem(com_mod, eNoN, ptr, lK, lR)</tt> - If not using Trilinos <h2 id="do_assem"> void do_assem(ComMod& com_mod, const int d, const Vector<int>& eqN, const Array3<double>& lK, const Array<double>& lR) </h2> <a href="https://github.com/ktbolt/svFSI/blob/Implement-svFSI-using-cpp_19/Code/Source/svFSI_cinterface/lhsa.cpp" >lhsa.cpp Modifies @icode com_mod.R com_mod.Val @endicode