CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

A few questions about C++ in OpenFOAM

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 4, 2023, 23:42
Default A few questions about C++ in OpenFOAM
  #1
Member
 
WY
Join Date: Mar 2020
Posts: 36
Rep Power: 6
WUYing is on a distinguished road
Hi, I am new to OpenFOAM coding and have a few questions when studying the sample code.

1. The source file XXX.C generally includes a few parts, such as Static Member Functions, Protected Member Functions, Constructors, Destructor and Member Functions.
Q1. What is the difference between Protected Member Functions and Member Functions?
Q2. If I understand correctly, the Constructors is equivalent to the main function, determining how the solver is been used. (Please correct me if I make mistake)

2. I notice that some functions are virtual, so in what cases can a function be defined as a virtual function?

3. In the sample code, there are one fixed entry "A" (must be run) and two optional entries "B" and "C" (run if the entries are included in fvOptions file). Now I modify the sample code to change "A" as an optional entry like "B" and "C" and I don't define "A" in the fvOptions file. So "A" would not be executed during running, but I always receive the error :
keyword A is undefined in dictionary ".....fvOptions".

The output error only show the absent definition of A in fvOptions, is there any way to find the location of the error in the source code?

Any suggestion is welcome! Thanks!
WUYing is offline   Reply With Quote

Reply

Tags
c++ solver class, source files


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Other] Basic questions about OpenFOAM cluster running and installing Fauster OpenFOAM Installation 0 May 25, 2018 15:00
OpenFOAM 4.0 Released CFDFoundation OpenFOAM Announcements from OpenFOAM Foundation 2 October 6, 2017 05:40
UNIGE February 13th-17th - 2107. OpenFOAM advaced training days joegi.geo OpenFOAM Announcements from Other Sources 0 October 1, 2016 19:20
OpenFOAM Training Jan-Apr 2017, Virtual, London, Houston, Berlin cfd.direct OpenFOAM Announcements from Other Sources 0 September 21, 2016 11:50
OpenFOAM Training, London, Chicago, Munich, Houston 2016-2017 cfd.direct OpenFOAM Announcements from Other Sources 0 September 14, 2016 03:19


All times are GMT -4. The time now is 01:23.